Merged
Conversation
8691862 to
3008bf8
Compare
- Stepped UI with numbered badges for copy/paste flow - Proper completed state: success shows Done, error shows Try again - Cancel polling on dialog close via AbortController - Consistent message styling with bordered pill pattern - Copy button shows "Copied" feedback Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The DELETE /api/providers/openai-chatgpt endpoint now removes the OAuth JSON credentials file instead of trying to look up a TOML key. Re-enable the Remove button in the UI for the ChatGPT Plus card. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
57fe648 to
fb9114a
Compare
- Remove response body from device-code parse error to avoid leaking user_code into logs - Clean up abort listener on timeout to prevent accumulation during long polls - Clear in-memory OAuth credentials when removing openai-chatgpt provider, not just the file on disk Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
jamiepine
approved these changes
Feb 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix ChatGPT Plus OAuth: switch to device code flow
The browser-based PKCE OAuth flow broke because the callback URL changed during cleanup — a
localhostredirect doesn't work for non-localhost instances. This switches to the device code flow instead, which is simpler and avoids popup blockers entirely.How it works now: user copies a device code, opens OpenAI's verification page, pastes the code, and we poll until they approve.
Changes
Backend (
openai_auth.rs,providers.rs)request_device_code→poll_device_authorization→exchange_device_code)DELETE /api/providers/openai-chatgptto remove OAuth credentialsFrontend (
Settings.tsx)Summary
This PR migrates OpenAI ChatGPT Plus OAuth from a browser-based PKCE flow to a device code flow. The core change eliminates the need for popup windows and redirect callbacks, replacing them with a simpler device code authorization pattern where users enter a code on a verification page.
Key changes:
Frontend — Updated Settings component to display device code and verification URL instead of opening a popup. Added state management for device code info and increased polling timeout from 180 to 360 attempts.
Backend OAuth flow — Completely rewrote
/providers/openai/oauth/browser/*endpoints to use device code flow. Removed browser popup logic, PKCE verifier handling, and the callback endpoint. Spawns background task to poll for authorization and exchange tokens.New device code functions — Added three new async functions in
openai_auth.rs:request_device_code()— requests device code from OpenAIpoll_device_authorization()— polls until user approves on OpenAI's device auth pageexchange_device_code()— exchanges authorization code for OAuth tokensSession management — Renamed session types from
BrowserOAuthSessiontoDeviceOAuthSession, simplified session data (removed PKCE and redirect URI), increased TTL from 15 to 30 minutes.API responses — Updated
OpenAiOAuthBrowserStartResponseto returnuser_codeandverification_urlinstead ofauthorization_url.Note
This changes the OAuth flow from browser-based to device code based. The device code pattern is simpler and avoids popup blockers. Users now enter a code directly on OpenAI's site instead of a redirect flow. Polling is now triggered automatically when the OAuth dialog opens and is cancelled when the dialog closes.
Written by Tembo for commit fb9114a. This will update automatically on new commits.