Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(auth): add support for device code grant flow #5680

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
62cf21c
experiment: initial device auth
Nerixyz Nov 11, 2023
8241ea0
fix: compilations
Nerixyz Oct 27, 2024
738cdde
fix: formatting and changelog
Nerixyz Oct 27, 2024
5fcb033
Merge remote-tracking branch 'upstream/master' into experiment/device…
Nerixyz Nov 9, 2024
77ea204
link
Nerixyz Nov 9, 2024
5877c60
tidy
Nerixyz Nov 9, 2024
082b5b2
inc
Nerixyz Nov 9, 2024
35823a5
Merge branch 'master' into experiment/device-auth
Nerixyz Nov 9, 2024
8f4d293
Merge remote-tracking branch 'upstream/master' into experiment/device…
Nerixyz Nov 24, 2024
485b276
Merge remote-tracking branch 'upstream/master' into experiment/device…
Nerixyz Nov 30, 2024
97bc78e
fix: check scopes
Nerixyz Jan 26, 2025
383743e
Merge remote-tracking branch 'upstream/master' into experiment/device…
Nerixyz Jan 26, 2025
5880b6a
fix: qt5
Nerixyz Jan 26, 2025
9733755
chore: sticky state
Nerixyz Jan 29, 2025
8467f0c
fix: try after close too
Nerixyz Feb 1, 2025
d5a391f
Merge remote-tracking branch 'upstream/master' into experiment/device…
Nerixyz Feb 1, 2025
e6ac683
fix: use-after-move
Nerixyz Feb 1, 2025
2ca5003
changelog
Nerixyz Feb 1, 2025
ae6a92a
changelog-
Nerixyz Feb 1, 2025
9876cbe
Merge remote-tracking branch 'upstream/master' into experiment/device…
Nerixyz Feb 5, 2025
b104ca2
fix: keywords
Nerixyz Feb 5, 2025
7a884d2
Merge remote-tracking branch 'upstream/master' into experiment/device…
Nerixyz Feb 25, 2025
195b582
eventsub
Nerixyz Feb 25, 2025
146ccb7
how did he forget this?
Nerixyz Feb 25, 2025
1b84dff
sync scopes
Nerixyz Feb 25, 2025
888b375
transparent
Nerixyz Feb 25, 2025
2ea783d
Merge remote-tracking branch 'upstream/master' into experiment/device…
Nerixyz Mar 9, 2025
43b59a5
fix: using and sus user
Nerixyz Mar 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
how did he forget this?
Nerixyz committed Feb 25, 2025
commit 146ccb79f2818806c846c2fd65a6e732f20a42d7
22 changes: 13 additions & 9 deletions src/widgets/dialogs/LoginDialog.cpp
Original file line number Diff line number Diff line change
@@ -119,7 +119,7 @@ class DeviceLoginJob : public QObject
std::chrono::milliseconds interval;
};

DeviceLoginJob(Session session);
DeviceLoginJob(DeviceLoginWidget *ui, Session session);

private:
void ping();
@@ -238,12 +238,15 @@ void DeviceLoginWidget::tryInitSession(const QJsonObject &response)
assert(false && "There shouldn't be any job at this point");
this->job_->deleteLater();
}
this->job_ = new DeviceLoginJob({
.deviceCode = deviceCode,
.scopes = this->scopes_,
.expiry = std::chrono::seconds(response["expires_in"_L1].toInt(1800)),
.interval = std::chrono::seconds(response["interval"_L1].toInt(5)),
});
this->job_ = new DeviceLoginJob(
this,
{
.deviceCode = deviceCode,
.scopes = this->scopes_,
.expiry =
std::chrono::seconds(response["expires_in"_L1].toInt(1800)),
.interval = std::chrono::seconds(response["interval"_L1].toInt(5)),
});
QObject::connect(this->job_, &QObject::destroyed, this, [this] {
this->job_ = nullptr;
});
@@ -338,8 +341,9 @@ void DeviceLoginWidget::displayError(const QString &error)
}
}

DeviceLoginJob::DeviceLoginJob(Session session)
: session_(std::move(session))
DeviceLoginJob::DeviceLoginJob(DeviceLoginWidget *ui, Session session)
: ui(ui)
, session_(std::move(session))
{
QObject::connect(&this->expiryTimer_, &QTimer::timeout, this,
&QObject::deleteLater);