-
Notifications
You must be signed in to change notification settings - Fork 591
Description
Bug report
- I confirm this is a bug with Supabase, not with my own application.
- I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
The Supabase Auth (GoTrue) API's PKCE token exchange endpoint uses a non-standard parameter name auth_code instead of the OAuth2 RFC 6749 standard code. This creates confusion because:
- The OAuth2 RFC 6749 specification uses
code - Supabase's own documentation consistently refers to
code - All official Supabase SDKs expect and document
code - The OpenAPI spec contradicts both the docs and the OAuth2 standard
To Reproduce
-
Check the OpenAPI specification: https://github.com/supabase/auth/blob/master/openapi.yaml#L102
- Shows parameter named
auth_codefor PKCE flow
- Shows parameter named
-
Compare with Supabase documentation: https://supabase.com/docs/guides/auth/sessions/pkce-flow
- States: "The code parameter is commonly known as the Auth Code"
-
Compare with OAuth2 standard (❗that your PKCE docs link to): https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2
- Specifies authorization response returns parameter named
code
- Specifies authorization response returns parameter named
-
Check SDK implementations expecting
code:- C# SDK:
ExchangeCodeForSession(string codeVerifier, string authCode)- parameter namedauthCodebut docs reference "code" - JavaScript SDK:
exchangeCodeForSession(code)- parameter namedcode - All examples show extracting
codefrom URL query params
- C# SDK:
Expected behavior
The API should use code to match:
-
OAuth2 RFC 6749 specification (https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2):
- Section 4.1.2 Authorization Response specifies parameter
code
- Section 4.1.2 Authorization Response specifies parameter
-
Supabase's own documentation:
- PKCE Flow docs: "The code parameter..." (https://supabase.com/docs/guides/auth/sessions/pkce-flow)
- OAuth 2.1 Flows docs show:
'code=<authorization-code>'(https://supabase.com/docs/guides/auth/oauth-server/oauth-flows) - All provider docs:
const code = requestUrl.searchParams.get("code")
-
Standard OAuth2 implementations:
- Google, GitHub, Microsoft all use
code - Supabase's redirect URLs contain
?code=xyz, not?auth_code=xyz
- Google, GitHub, Microsoft all use
Current vs. Expected
Current (OpenAPI spec):
auth_code:
type: string
description: Auth code from PKCE flowExpected (OAuth2 standard):
code:
type: string
description: Authorization code from OAuth2 PKCE flowImpact
This inconsistency:
- Violates OAuth2 standards without justification
- Contradicts Supabase's own documentation
- Creates confusion for developers implementing PKCE flows
- Forces SDK maintainers to use non-standard parameter names or do parameter mapping
- Makes Supabase Auth incompatible with standard OAuth2 tooling
Evidence Links
OpenAPI spec using auth_code:
Supabase docs using code:
- https://supabase.com/docs/guides/auth/sessions/pkce-flow
- https://supabase.com/docs/guides/auth/oauth-server/oauth-flows
OAuth2 RFC 6749 standard:
SDK implementations:
- C# SDK docs: https://supabase-community.github.io/gotrue-csharp/api/Supabase.Gotrue.Client.html
- JavaScript SDK: https://supabase.com/docs/reference/javascript/auth-exchangecodeforsession
System information
- Affected: Supabase Auth (GoTrue) API
- Version: Current production
- Impact: All SDKs and direct API users
Additional context
The parameter should be renamed from auth_code to code in the actual API implementation to:
- Comply with OAuth2 RFC 6749
- Match Supabase's documentation
- Align with all major OAuth2 providers
- Eliminate confusion between docs and implementation
This appears to be a case where the implementation diverged from both standards and documentation without updating either consistently.