From 0f62b87733451584fada7e4064b7e730998f47e7 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Mon, 27 Jul 2026 03:56:15 +0200 Subject: [PATCH] fix(oidc): scope includes trailing whitespace if groups not configured (#775) --- internal/auth/oauth/openid.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 {