mirror of
https://github.com/immich-app/immich.git
synced 2025-04-21 15:36:26 +02:00
fix(server): validate oauth profile has a sub (#15967)
This commit is contained in:
parent
fb21950ad8
commit
758bcd1e97
1 changed files with 6 additions and 1 deletions
|
@ -43,7 +43,12 @@ export class OAuthRepository {
|
|||
const params = client.callbackParams(url);
|
||||
try {
|
||||
const tokens = await client.callback(redirectUrl, params, { state: params.state });
|
||||
return await client.userinfo<OAuthProfile>(tokens.access_token || '');
|
||||
const profile = await client.userinfo<OAuthProfile>(tokens.access_token || '');
|
||||
if (!profile.sub) {
|
||||
throw new Error('Unexpected profile response, no `sub`');
|
||||
}
|
||||
|
||||
return profile;
|
||||
} catch (error: Error | any) {
|
||||
if (error.message.includes('unexpected JWT alg received')) {
|
||||
this.logger.warn(
|
||||
|
|
Loading…
Add table
Reference in a new issue