diff --git a/webapp/src/identity.tsx b/webapp/src/identity.tsx index 8c1d047c6ac0..f0fe309399c9 100644 --- a/webapp/src/identity.tsx +++ b/webapp/src/identity.tsx @@ -100,9 +100,15 @@ export class UserMenu extends auth.Component { this.props.parent.signOutGithub(); } + encodedAvatarPic(user: pxt.auth.UserProfile): string { + const type = user?.idp?.picture?.mimeType; + const encodedImg = user?.idp?.picture?.encoded; + return type && encodedImg ? `data:${type};base64,${encodedImg}` : ""; + } + avatarPicUrl(): string { const user = this.getUserProfile(); - return user?.idp?.pictureUrl ?? user?.idp?.picture?.dataUrl; + return user?.idp?.pictureUrl ?? this.encodedAvatarPic(user); } hide() {