Skip to content

Commit be3908f

Browse files
committed
feat(auth): use existing client object
1 parent b136bb3 commit be3908f

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3571,7 +3571,24 @@ export default class GoTrueClient {
35713571
return await _request(this.fetch, 'GET', `${this.url}/user/oauth/grants`, {
35723572
headers: this.headers,
35733573
jwt: session.access_token,
3574-
xform: (data: any) => ({ data, error: null }),
3574+
xform: (data: any) => {
3575+
// Transform flat API response to nested client structure
3576+
return {
3577+
data: {
3578+
grants: data.grants.map((grant: any) => ({
3579+
client: {
3580+
client_id: grant.client_id,
3581+
client_name: grant.client_name,
3582+
client_uri: grant.client_uri,
3583+
logo_uri: grant.logo_uri,
3584+
},
3585+
scopes: grant.scopes,
3586+
granted_at: grant.granted_at,
3587+
})),
3588+
},
3589+
error: null,
3590+
}
3591+
},
35753592
})
35763593
})
35773594
} catch (error) {

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1681,14 +1681,8 @@ export type AuthOAuthConsentResponse = RequestResult<{
16811681
* Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
16821682
*/
16831683
export type OAuthGrant = {
1684-
/** OAuth client identifier (UUID) */
1685-
client_id: string
1686-
/** Human-readable name of the OAuth client */
1687-
client_name: string
1688-
/** URI of the OAuth client's website */
1689-
client_uri: string
1690-
/** URI of the OAuth client's logo */
1691-
logo_uri: string
1684+
/** OAuth client information */
1685+
client: OAuthAuthorizationClient
16921686
/** Array of scopes granted to this client */
16931687
scopes: string[]
16941688
/** Timestamp when the grant was created (ISO 8601 date-time) */

0 commit comments

Comments
 (0)