Skip to content

Commit a209b8e

Browse files
committed
Just do the check if the scopes are empty.
1 parent 48eb4cb commit a209b8e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/http/middleware/scope_challenge.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func WithScopeChallenge(oauthCfg *oauth.Config, scopeFetcher scopes.FetcherInter
9797
// Get OAuth scopes for Token. First check if scopes are already in context, then fetch from GitHub if not present.
9898
// This allows Remote Server to pass scope info to avoid redundant GitHub API calls.
9999
activeScopes, ok := ghcontext.GetTokenScopes(ctx)
100-
if !ok {
100+
if !ok || (len(activeScopes) == 0 && tokenInfo.Token != "") {
101101
activeScopes, err = scopeFetcher.FetchTokenScopes(ctx, tokenInfo.Token)
102102
if err != nil {
103103
next.ServeHTTP(w, r)

0 commit comments

Comments
 (0)