Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ const UserProfileButton: React.FC<{}> = () => {
trigger={["click"]}
>
<div className="h-8 w-8 cursor-pointer">
{user.image && user.image.indexOf("googleusercontent.com/") < 0 ? (
{user.image ? (
<img className="rounded-full w-8 h-8" src={user.image} about="userpic" alt="" width="100" height="100" />
) : (
<FaUserCircle className="text-primary w-full h-full" />
Expand Down
8 changes: 8 additions & 0 deletions webapps/console/lib/nextauth.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ export const nextAuthConfig: NextAuthOptions = {
mustChangePassword: user.mustChangePassword,
externalUsername: props.profile?.["login"],
loginProvider: loginProvider,
// Propagate avatar from OIDC/GitHub profile to the JWT token.
// Google OIDC uses "picture", GitHub uses "avatar_url".
picture: props.token.picture || props.profile?.["picture"] || props.profile?.["avatar_url"],
...props.token,
};
},
Expand All @@ -174,6 +177,11 @@ export const nextAuthConfig: NextAuthOptions = {
loginProvider: token.loginProvider,
externalId: token.externalId,
externalUsername: token.externalUsername,
// Pass avatar URL to session so UI can render provider profile photos
user: {
...session.user,
image: (token.picture as string | undefined) || session.user?.image,
},
};
},
},
Expand Down