Support "integration" tokens
Integration tokens are different than OAuth token in it that they don't report any `X-Oauth-Scopes` in response headers.
This commit is contained in:
parent
626be2a095
commit
53cea2667e
2 changed files with 10 additions and 0 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue