diff --git a/internal/auth/oauth/openid.go b/internal/auth/oauth/openid.go index 1f7d457..ddcce42 100644 --- a/internal/auth/oauth/openid.go +++ b/internal/auth/oauth/openid.go @@ -20,15 +20,17 @@ type OIDCProvider struct { } func (p *OIDCProvider) RegisterProvider() error { + scopes := []string{"openid", "email", "profile"} + if config.C.OIDCGroupClaimName != "" { + scopes = append(scopes, config.C.OIDCGroupClaimName) + } + oidcProvider, err := openidConnect.New( config.C.OIDCClientKey, config.C.OIDCSecret, urlJoin(p.URL, "/oauth/openid-connect/callback"), config.C.OIDCDiscoveryUrl, - "openid", - "email", - "profile", - config.C.OIDCGroupClaimName, + scopes..., ) if err != nil {