Skip to content

Commit f807795

Browse files
committed
Fix pasting Personal Access Token to auth login for GHE
1 parent 04dcb32 commit f807795

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

pkg/cmd/auth/shared/oauth_scopes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func HasMinimumScopes(httpClient httpClient, hostname, authToken string) error {
4040
return err
4141
}
4242

43-
req.Header.Set("Autorization", "token "+authToken)
43+
req.Header.Set("Authorization", "token "+authToken)
4444

4545
res, err := httpClient.Do(req)
4646
if err != nil {

pkg/cmd/auth/shared/oauth_scopes_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ func Test_HasMinimumScopes(t *testing.T) {
5252
fakehttp := &httpmock.Registry{}
5353
defer fakehttp.Verify(t)
5454

55+
var gotAuthorization string
5556
fakehttp.Register(httpmock.REST("GET", ""), func(req *http.Request) (*http.Response, error) {
57+
gotAuthorization = req.Header.Get("authorization")
5658
return &http.Response{
5759
Request: req,
5860
StatusCode: 200,
@@ -70,6 +72,7 @@ func Test_HasMinimumScopes(t *testing.T) {
7072
} else {
7173
assert.NoError(t, err)
7274
}
75+
assert.Equal(t, gotAuthorization, "token ATOKEN")
7376
})
7477
}
7578

0 commit comments

Comments
 (0)