mirror of
https://github.com/immich-app/immich.git
synced 2025-05-31 12:15:47 -04:00
fix(server): validate oauth profile has a sub (#15967)
This commit is contained in:
parent
fb21950ad8
commit
758bcd1e97
@ -43,7 +43,12 @@ export class OAuthRepository {
|
|||||||
const params = client.callbackParams(url);
|
const params = client.callbackParams(url);
|
||||||
try {
|
try {
|
||||||
const tokens = await client.callback(redirectUrl, params, { state: params.state });
|
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) {
|
} catch (error: Error | any) {
|
||||||
if (error.message.includes('unexpected JWT alg received')) {
|
if (error.message.includes('unexpected JWT alg received')) {
|
||||||
this.logger.warn(
|
this.logger.warn(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user