Skip to content

Conversation

@jfoshee
Copy link
Contributor

@jfoshee jfoshee commented Jan 7, 2026

because when the SSO button is used in an OAuth App (3rd party integration) flow, the user must be redirected to the consent page / 3rd party callback page. (This is a little confusing because the OAuth app here is not the same as the OAuth provider/strategy for the SSO button)

🔎 Previews:

What does this solve?

What changed?

because when the SSO button is used in an OAuth App (3rd party integration) flow, the user must be redirected to the consent page / 3rd party callback page. (This is a little confusing because the OAuth app here is not the same as the OAuth provider/strategy for the SSO button)
@vercel
Copy link

vercel bot commented Jan 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
clerk-docs Ready Ready Preview Jan 14, 2026 10:07pm

@jfoshee jfoshee force-pushed the jacobfoshee/user-4262-improve-docs-for-supporting-oauth-integrations-with-custom branch from 7483857 to 2c13d13 Compare January 12, 2026 23:25
In clerk.ts, the handleRedirectCallback method creates a RedirectUrls instance like this:
    const redirectUrls = new RedirectUrls(this.#options, params);

But the RedirectUrls constructor expects search params as the third argument:

constructor(options: ClerkOptions, props: RedirectOptions = {}, searchParams: any = {}, mode?: ComponentMode)
Since no searchParams is passed, the redirect_url from the URL query string is never read. The code falls through to the default '/'.
The Fix
The SSO callback page must:
Read redirect parameters from the URL using useSearchParams()
Pass them as props to <AuthenticateWithRedirectCallback>
The key change in the SSO callback page:
const searchParams = useSearchParams()const redirectUrl = searchParams.get('redirect_url') ?? undefinedconst signInFallbackRedirectUrl = searchParams.get('sign_in_fallback_redirect_url') ?? undefined// ... etcreturn (  <AuthenticateWithRedirectCallback    redirectUrl={redirectUrl}    signInFallbackRedirectUrl={signInFallbackRedirectUrl}    // ... etc  />)
This ensures the redirect parameters are passed to handleRedirectCallback via component props, where they get picked up by RedirectUrls through fromProps instead of the missing fromSearchParams.
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