Skip to content

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

Merged
diegosouzapw merged 1 commit into
mainfrom
fix/codex-oauth-redirect-uri
Feb 18, 2026
Merged

fix(oauth): use registered redirect_uri for Codex on remote access#75
diegosouzapw merged 1 commit into
mainfrom
fix/codex-oauth-redirect-uri

Conversation

@diegosouzapw

Copy link
Copy Markdown
Owner

When accessing OmniRoute remotely, Codex OAuth redirect_uri was set to http://localhost:443/callback — not registered with OpenAI. Now uses http://localhost:1455/auth/callback.

When accessing OmniRoute remotely (e.g. llms.omniroute.online), the
Codex OAuth redirect_uri was incorrectly set to http://localhost:443/callback.
OpenAI only accepts the registered http://localhost:1455/auth/callback.

This caused 'unknown_error' on auth.openai.com for remote users.
Other providers (Google-based: Antigravity, Gemini) are unaffected as
Google OAuth accepts any localhost port.
Copilot AI review requested due to automatic review settings February 18, 2026 04:42
@github-actions

Copy link
Copy Markdown
Contributor

@codex review

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @diegosouzapw, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a critical authentication problem for Codex (OpenAI) when users attempt to access OmniRoute remotely. By ensuring the correct, pre-registered redirect_uri is used specifically for Codex, it enhances the reliability and success rate of the OAuth flow for this provider, preventing users from encountering an error page during the redirect process.

Highlights

  • OAuth Redirect URI Fix: Addressed an issue where the redirect_uri for Codex (OpenAI) OAuth was incorrectly set to http://localhost:443/callback during remote access, causing authentication failures.
  • Specific Redirect URI for Codex: Implemented a conditional logic to use the exact registered http://localhost:1455/auth/callback for Codex/OpenAI providers, while other providers continue to use a dynamically generated localhost port.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/shared/components/OAuthModal.tsx
    • Modified the logic for determining the OAuth redirectUri.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@diegosouzapw
diegosouzapw merged commit 3a15c6f into main Feb 18, 2026
7 checks passed
@diegosouzapw
diegosouzapw deleted the fix/codex-oauth-redirect-uri branch February 18, 2026 04:42
@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug in the Codex OAuth flow when accessing OmniRoute remotely. Previously, when remote users attempted to authenticate, the redirect URI was incorrectly constructed as http://localhost:443/callback, which is not registered with OpenAI. The fix ensures Codex always uses the correct registered redirect URI: http://localhost:1455/auth/callback.

Changes:

  • Updated OAuthModal to use the fixed registered redirect URI for Codex OAuth flows
  • Added provider-specific logic to distinguish between Codex (requiring fixed port 1455) and other providers (accepting dynamic ports)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// 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") {

Copilot AI Feb 18, 2026

Copy link

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 be if (provider === "codex").

Suggested change
if (provider === "codex" || provider === "openai") {
if (provider === "codex") {

Copilot uses AI. Check for mistakes.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly fixes an OAuth issue for the Codex provider during remote access by using the registered redirect_uri. The change also applies this fix to the openai provider, which is a reasonable approach since both use OpenAI's authentication system. The implementation is sound, but I have a minor suggestion to improve the code's maintainability for the provider check.

Comment on lines +217 to +222
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`;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To improve readability and future maintainability, it's better to use an array with includes() for checking the provider. This approach is more scalable if you need to add more providers that require this specific redirect URI in the future. I'd also recommend extracting the hardcoded redirect URI into a constant defined at a suitable scope.

Suggested change
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`;
}
if (["codex", "openai"].includes(provider)) {
redirectUri = "http://localhost:1455/auth/callback";
} else {
const port = window.location.port || (window.location.protocol === "https:" ? "443" : "80");
redirectUri = `http://localhost:${port}/callback`;
}

diegosouzapw added a commit that referenced this pull request Mar 7, 2026
fix(oauth): use registered redirect_uri for Codex on remote access
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants