diff --git a/plugins/auth-backend/src/lib/passport/PassportStrategyHelper.ts b/plugins/auth-backend/src/lib/passport/PassportStrategyHelper.ts index a0c07943c1..67c2678f8b 100644 --- a/plugins/auth-backend/src/lib/passport/PassportStrategyHelper.ts +++ b/plugins/auth-backend/src/lib/passport/PassportStrategyHelper.ts @@ -30,8 +30,6 @@ export const makeProfileInfo = ( profile: passport.Profile, idToken?: string, ): ProfileInfo => { - let { displayName } = profile; - let email: string | undefined = undefined; if (profile.emails && profile.emails.length > 0) { const [firstEmail] = profile.emails; @@ -44,6 +42,9 @@ export const makeProfileInfo = ( picture = firstPhoto.value; } + let displayName: string | undefined = + profile.displayName ?? profile.username ?? profile.id; + if ((!email || !picture || !displayName) && idToken) { try { const decoded: Record = jwtDecoder(idToken);