Repository navigation
fix(auth): correct OAuth authorization types to match API responses - #2088
Merged
Merged
Conversation
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughTwo files in the auth-js package are updated: GoTrueClient.ts receives a minor documentation revision regarding OAuth redirect terminology, while lib/types.ts introduces new OAuth types and extends the GoTrueAdminOAuthApi interface with grant management methods. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
cemalkilic
approved these changes
Feb 4, 2026
mandarini
marked this pull request as ready for review
February 4, 2026 14:37
This was referenced Feb 4, 2026
Closed
7 tasks done
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed incorrect field names and enhanced type safety for OAuth 2.1 authorization server APIs.
Changes:
OAuthAuthorizationDetails.redirect_url→redirect_uri(matchesGoTrueAPIfield name)redirect_urirequired (API always returns this field when consent is needed)OAuthRedirecttype for already-consented/post-consent responsesAuthOAuthAuthorizationDetailsResponse(OAuthAuthorizationDetails|OAuthRedirect)OAuthRedirecttypes.tsandGoTrueClient.tsto reference correct field namesRoot Cause:
PR #1891 (Nov 2025) incorrectly changed
redirect_uritoredirect_url. However, the GoTrue API intentionally uses two different field names:redirect_uri: Base redirect URI from client registration (inAuthorizationDetailsResponse)redirect_url: Complete redirect URL with code/state parameters (inConsentResponse)From Auth server code:
The original implementation in PR #1793 (Oct 2025) had the correct field name.
Type Safety Impact:
The union type now requires developers to narrow the response type using TypeScript's discriminated unions (
'authorization_id'in data), preventing runtime errors when accessing fields that may not exist in the already-consented case.Summary by CodeRabbit
Release Notes
New Features
Documentation