Skip to content

Commit 086112e

Browse files
authored
fix(auth): remove redirection in getAuthorizationDetails (#1811)
1 parent 255d8dd commit 086112e

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

packages/core/auth-js/src/GoTrueClient.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3362,10 +3362,13 @@ export default class GoTrueClient {
33623362
/**
33633363
* Retrieves details about an OAuth authorization request.
33643364
* Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
3365+
*
3366+
* Returns authorization details including client info, scopes, and user information.
3367+
* If the API returns a redirect_uri, it means consent was already given - the caller
3368+
* should handle the redirect manually if needed.
33653369
*/
33663370
private async _getAuthorizationDetails(
3367-
authorizationId: string,
3368-
options?: { skipBrowserRedirect?: boolean }
3371+
authorizationId: string
33693372
): Promise<AuthOAuthAuthorizationDetailsResponse> {
33703373
try {
33713374
return await this._useSession(async (result) => {
@@ -3389,17 +3392,7 @@ export default class GoTrueClient {
33893392
{
33903393
headers: this.headers,
33913394
jwt: session.access_token,
3392-
xform: (data: any) => {
3393-
// If the API returns redirect_uri, it means consent was already given
3394-
if (data.redirect_uri) {
3395-
// Automatically redirect in browser unless skipBrowserRedirect is true
3396-
if (isBrowser() && !options?.skipBrowserRedirect) {
3397-
window.location.assign(data.redirect_uri)
3398-
}
3399-
}
3400-
3401-
return { data, error: null }
3402-
},
3395+
xform: (data: any) => ({ data, error: null }),
34033396
}
34043397
)
34053398
})

packages/core/auth-js/src/lib/types.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,14 +1655,14 @@ export interface AuthOAuthServerApi {
16551655
* Used to display consent information to the user.
16561656
* Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
16571657
*
1658+
* This method returns authorization details including client info, scopes, and user information.
1659+
* If the response includes a redirect_uri, it means consent was already given - the caller
1660+
* should handle the redirect manually if needed.
1661+
*
16581662
* @param authorizationId - The authorization ID from the authorization request
1659-
* @param options - Optional parameters including skipBrowserRedirect
16601663
* @returns Authorization details including client info and requested scopes
16611664
*/
1662-
getAuthorizationDetails(
1663-
authorizationId: string,
1664-
options?: { skipBrowserRedirect?: boolean }
1665-
): Promise<AuthOAuthAuthorizationDetailsResponse>
1665+
getAuthorizationDetails(authorizationId: string): Promise<AuthOAuthAuthorizationDetailsResponse>
16661666

16671667
/**
16681668
* Approves an OAuth authorization request.

0 commit comments

Comments
 (0)