Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

fix(oauth): use registered redirect_uri for Codex on remote access

diegosouzapw62f3c7416ec7
diff --git a/src/shared/components/OAuthModal.tsx b/src/shared/components/OAuthModal.tsx
index 36d2839172..c75ec2bf30 100644
--- a/src/shared/components/OAuthModal.tsx
+++ b/src/shared/components/OAuthModal.tsx
@@ -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`;
+ }
const res = await fetch(
`/api/oauth/${provider}/authorize?redirect_uri=${encodeURIComponent(redirectUri)}`