1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-06-27 16:36:00 +00:00

feat(oidc): use preferred_username first instead of email claim

This commit is contained in:
Frédéric Guillot 2025-06-08 18:00:29 -07:00
parent c41d189a7a
commit 699deea72c

View file

@ -75,7 +75,9 @@ func (o *oidcProvider) GetProfile(ctx context.Context, code, codeVerifier string
return nil, fmt.Errorf(`oidc: failed to parse user claims: %w`, err)
}
for _, value := range []string{userClaims.Email, userClaims.PreferredUsername, userClaims.Name, userClaims.Profile} {
// Use the first non-empty value from the claims to set the username.
// The order of preference is: preferred_username, email, name, profile.
for _, value := range []string{userClaims.PreferredUsername, userClaims.Email, userClaims.Name, userClaims.Profile} {
if value != "" {
profile.Username = value
break