Add "nickname" claim for better OIDC compat

This commit is contained in:
Peter Cai 2023-02-24 16:10:16 +01:00
parent 20ad51f214
commit 950f521002
1 changed files with 6 additions and 1 deletions

View File

@ -57,8 +57,13 @@ func UserInfo(ctx *gin.Context) {
for _, s := range scopes {
if value, ok := (*userinfo)[s]; ok {
userinfoRes[s] = value
} else if s == "openid" {
}
if s == "openid" {
userinfoRes["sub"] = *tokenInfo.Sub
} else if s == "username" {
// Add "nickname" field for OIDC compatibility
userinfoRes["nickname"] = userinfoRes[s]
}
}
}