Add QR code login with device authorization flow#496
Conversation
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e9518aa799
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if ("accessToken" in result) { | ||
| const session = await this.saveLoginSession(result, provider); | ||
| return { status: "authorized", session }; |
There was a problem hiding this comment.
Avoid saving QR sessions after cancellation
When the user clicks Cancel while a pollDeviceLogin IPC call is already in flight, the renderer only increments qrLoginAttemptRef and ignores the eventual response, but this branch has already exchanged the code and persisted/activated the session in main. In the case where the user approved on NVIDIA and then cancels before this request returns, Cancel leaves the login screen unauthenticated while credentials are still saved as the active account; the poll needs a server-side attempt/cancel check or should avoid committing auth state until the renderer confirms the attempt is still active.
Useful? React with 👍 / 👎.
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This PR adds QR code login functionality to OpenNOW, allowing users to authenticate via their mobile device or by entering a short code. It implements the OAuth 2.0 device authorization flow using NVIDIA's Steam Deck client profile, which is the only profile that supports the device flow endpoint.
Auth service changes:
startDeviceLoginandpollDeviceLoginmethods to AuthService for device authorization flowrequestDeviceAuthorizationto obtain device code and verification URLsexchangeDeviceCodeto poll NVIDIA servers until user completes login on mobilebuildAuthHeadersForClientto support multiple client profiles (Desktop vs Steam Deck)authClientIdto AuthTokens to track which client ID was used for loginIPC and preload contracts:
AUTH_DEVICE_LOGIN_STARTandAUTH_DEVICE_LOGIN_POLLIPC channelsstartDeviceLoginandpollDeviceLoginto OpenNowApi in preloadUI and renderer changes:
Localization:
Screenshot: