Skip to content

Commit 0b332d0

Browse files
committed
feat: render OAuth2 scopes before configuration
1 parent 7b02262 commit 0b332d0

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

core/dbio/api/auth.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,11 +413,21 @@ func (a *AuthenticatorOAuth2) Authenticate(ctx context.Context, state *APIStateA
413413
deviceAuthURL = strings.Replace(authURL, "/token", "/device/code", 1)
414414
}
415415

416+
// Render scopes
417+
scopes := make([]string, len(a.Scopes))
418+
for i, s := range a.Scopes {
419+
rendered, err := a.renderString(s)
420+
if err != nil {
421+
return g.Error(err, "could not render scope[%d]", i)
422+
}
423+
scopes[i] = rendered
424+
}
425+
416426
// Create OAuth2 config
417427
conf := &oauth2.Config{
418428
ClientID: clientID,
419429
ClientSecret: clientSecret,
420-
Scopes: a.Scopes,
430+
Scopes: scopes,
421431
Endpoint: oauth2.Endpoint{
422432
AuthURL: authorizeURL,
423433
TokenURL: authURL,

0 commit comments

Comments
 (0)