-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
fix(oauth): use registered redirect_uri for Codex on remote access #75
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -211,8 +211,15 @@ export default function OAuthModal({ | |||||||||||||||||||||||||
| // Authorization code flow | ||||||||||||||||||||||||||
| // Always use localhost redirect_uri — this is what providers have registered. | ||||||||||||||||||||||||||
| // On remote, the browser redirects to localhost (error page), user copies URL and pastes back. | ||||||||||||||||||||||||||
| const port = window.location.port || (window.location.protocol === "https:" ? "443" : "80"); | ||||||||||||||||||||||||||
| const redirectUri = `http://localhost:${port}/callback`; | ||||||||||||||||||||||||||
| // Codex (OpenAI) requires exactly http://localhost:1455/auth/callback — the registered URI. | ||||||||||||||||||||||||||
| // Other providers (Antigravity/Gemini via Google OAuth) accept any localhost port. | ||||||||||||||||||||||||||
| let redirectUri: string; | ||||||||||||||||||||||||||
| if (provider === "codex" || provider === "openai") { | ||||||||||||||||||||||||||
| redirectUri = "http://localhost:1455/auth/callback"; | ||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||
| const port = window.location.port || (window.location.protocol === "https:" ? "443" : "80"); | ||||||||||||||||||||||||||
| redirectUri = `http://localhost:${port}/callback`; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
Comment on lines
+217
to
+222
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To improve readability and future maintainability, it's better to use an array with
Suggested change
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| const res = await fetch( | ||||||||||||||||||||||||||
| `/api/oauth/${provider}/authorize?redirect_uri=${encodeURIComponent(redirectUri)}` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition checks for
provider === "openai", but "openai" is not a registered provider in the PROVIDERS map (src/lib/oauth/providers/index.ts) or in the provider constants (src/shared/constants/providers.ts). Only "codex" exists as an OAuth provider. This check is unreachable dead code and should be removed. The condition should simply beif (provider === "codex").