Skip to content

fix(gotrue): ask the server to skip its redirect when linking an identity - #379

Open
yzxcj797 wants to merge 1 commit into
supabase-community:masterfrom
yzxcj797:fix/link-identity-skip-redirect-378
Open

fix(gotrue): ask the server to skip its redirect when linking an identity#379
yzxcj797 wants to merge 1 commit into
supabase-community:masterfrom
yzxcj797:fix/link-identity-skip-redirect-378

Conversation

@yzxcj797

Copy link
Copy Markdown

Fixes #378.

Root cause

Api.LinkIdentity issues its GET /user/identities/authorize without skip_http_redirect. The server responds with a redirect to the provider's sign-in page; the browser follows the redirect without the Authorization header, and the request then fails with:

{"message":"No API key found in request","hint":"No `apikey` request header or url param was found."}

auth-js' linkIdentity sets skip_http_redirect for exactly this reason — with it, the server returns the provider URL in the response body for the client to navigate to, instead of redirecting (the same shape this SDK's own signInWithSSO already relies on, see its skip_http_redirect body parameter).

Fix

Add skip_http_redirect=true to the query on the LinkIdentity request, matching auth-js. The returned ProviderAuthState (whose URI the caller navigates to) is unchanged.

Test

Added LinkIdentityRequest_ShouldCarrySkipHttpRedirect_GivenAnyProvider to the wire-shape approval tests (IdentityLinkApprovalTests): asserts the emitted request hits /user/identities/authorize with skip_http_redirect=true, using the fixture's new EmittedRequest accessor alongside the existing EmittedRequestBody.

Note: no .NET SDK on this machine — the change follows the file's existing patterns exactly (Helpers.AddQueryParams is already used the same way elsewhere) and CI runs the suite.

…tity

LinkIdentity issues its GET to /user/identities/authorize without
skip_http_redirect, so the server responds with a redirect to the
provider's sign-in page. The browser follows it without the
Authorization header and the request fails with 'No API key found in
request' (supabase-community#378). auth-js' linkIdentity sets skip_http_redirect for
exactly this reason; add the query parameter so the response returns
the provider URL for the client to navigate to instead.

Fixes supabase-community#378
@fresh55

fresh55 commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

diagnosis in #378 looks right, but i pulled the branch and ran the tests locally, three things

  • the response body gets discarded, the server replies with the provider url and that is the one the caller opens, here the state is built before the request so LinkIdentity still returns the local authorize url and reproduces the issue
  • EmittedRequest does not compile, ReceivedRequest is internal, fixture is public, CS0053
  • Constants.Provider.GitHub does not exist, the member is Github, CS0117

request side is handled, response side is still open

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.

Error Linking Identity due to missing API key when skip_http_redirect is not set to true

2 participants