mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-04 04:42:37 +02:00
Revert "feat: integrate Supabase OAuth with OIDC discovery for authentication"
This reverts commit bbe82c124d.
This commit is contained in:
parent
d7b84f87d0
commit
9747c55d0e
10 changed files with 8 additions and 358 deletions
|
|
@ -159,16 +159,13 @@ export function buildAuthorizationUrl(
|
|||
state: string;
|
||||
}
|
||||
): URL {
|
||||
const url = client.buildAuthorizationUrl(config, {
|
||||
return client.buildAuthorizationUrl(config, {
|
||||
redirect_uri: params.redirectUri,
|
||||
scope: params.scope,
|
||||
code_challenge: params.codeChallenge,
|
||||
code_challenge_method: 'S256',
|
||||
state: params.state,
|
||||
});
|
||||
|
||||
console.log(`[OAuth] Authorization URL: ${url}`);
|
||||
return url;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -179,7 +176,7 @@ export async function exchangeCodeForTokens(
|
|||
callbackUrl: URL,
|
||||
codeVerifier: string,
|
||||
expectedState: string
|
||||
): Promise<{ tokens: OAuthTokens; sub?: string }> {
|
||||
): Promise<OAuthTokens> {
|
||||
console.log(`[OAuth] Exchanging authorization code for tokens...`);
|
||||
|
||||
const response = await client.authorizationCodeGrant(config, callbackUrl, {
|
||||
|
|
@ -187,27 +184,8 @@ export async function exchangeCodeForTokens(
|
|||
expectedState,
|
||||
});
|
||||
|
||||
const claims = response.claims();
|
||||
console.log(`[OAuth] Token exchange successful`);
|
||||
return {
|
||||
tokens: toOAuthTokens(response),
|
||||
sub: claims?.sub,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch user info from the OIDC userinfo endpoint (discovered via issuer metadata)
|
||||
*/
|
||||
export async function fetchUserInfo(
|
||||
config: client.Configuration,
|
||||
accessToken: string,
|
||||
expectedSubject: string
|
||||
): Promise<{ email: string; name?: string }> {
|
||||
const userInfo = await client.fetchUserInfo(config, accessToken, expectedSubject);
|
||||
return {
|
||||
email: userInfo.email ?? '',
|
||||
name: userInfo.name,
|
||||
};
|
||||
return toOAuthTokens(response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -77,22 +77,7 @@ const providerConfigs: ProviderConfig = {
|
|||
'profile',
|
||||
'email',
|
||||
]
|
||||
},
|
||||
rowboat: {
|
||||
discovery: {
|
||||
mode: 'issuer',
|
||||
issuer: 'https://yhafoahozylbdyyyqjep.supabase.co/auth/v1',
|
||||
},
|
||||
client: {
|
||||
mode: 'static',
|
||||
clientId: '0b8a99ec-b5b2-4ddf-8e14-69a3a1675114',
|
||||
},
|
||||
scopes: [
|
||||
'openid',
|
||||
'email',
|
||||
'profile',
|
||||
],
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ export const OAuthTokens = z.object({
|
|||
expires_at: z.number(), // Unix timestamp
|
||||
token_type: z.literal('Bearer').optional(),
|
||||
scopes: z.array(z.string()).optional(), // Granted scopes from OAuth response
|
||||
id_token_sub: z.string().optional(), // Subject claim from ID token
|
||||
});
|
||||
|
||||
export type OAuthTokens = z.infer<typeof OAuthTokens>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue