Skip to content

Conversation

@amrit110
Copy link
Member

This pull request updates the OAuth callback route to ensure all redirects use a consistent base URL, which can be configured via an environment variable. This change makes redirect behavior more predictable, especially in environments where the app may be accessed from different domains or behind proxies.

Redirect handling improvements:

  • Added a getBaseUrl helper function to determine the base URL for redirects, using the NEXT_PUBLIC_APP_URL environment variable if set, or falling back to the request's origin. All redirects now use this base URL for consistency.
  • Updated all redirect responses in the OAuth callback handler to use the new base URL, including error cases and after successful authentication. This affects redirects for errors such as invalid callback, invalid state, missing verifier, token exchange failure, unauthorized domain, and general authentication failure. [1] [2] [3]

@amrit110 amrit110 self-assigned this Nov 28, 2025
@amrit110 amrit110 added the bug Something isn't working label Nov 28, 2025
@amrit110 amrit110 changed the title Fix buf with redirect url Fix bug with redirect url Nov 28, 2025
@amrit110 amrit110 merged commit 770e9fe into main Nov 28, 2025
3 checks passed
@amrit110 amrit110 deleted the fix_base_url_redirect_bug branch November 28, 2025 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants