auth-backend: fall back to username and id as displayName for profiles
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -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<string, string> = jwtDecoder(idToken);
|
||||
|
||||
Reference in New Issue
Block a user