diff --git a/api/client.go b/api/client.go index b290aae3d..09195181b 100644 --- a/api/client.go +++ b/api/client.go @@ -196,6 +196,11 @@ func (c Client) HasMinimumScopes(hostname string) error { } scopesHeader := res.Header.Get("X-Oauth-Scopes") + if scopesHeader == "" { + // if the token reports no scopes, assume that it's an integration token and give up on + // detecting its capabilities + return nil + } search := map[string]bool{ "repo": false, diff --git a/api/client_test.go b/api/client_test.go index fd24a5404..35a45af8c 100644 --- a/api/client_test.go +++ b/api/client_test.go @@ -111,6 +111,11 @@ func Test_HasMinimumScopes(t *testing.T) { header string wantErr string }{ + { + name: "no scopes", + header: "", + wantErr: "", + }, { name: "default scopes", header: "repo, read:org",