Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 8aab983

Browse files
committed
http: improve TokenAuth documentation
Users are often confused with TokenAuth, since it might look that it should be used with GitHub's OAuth tokens. But that is not the case. TokenAuth implements HTTP bearer authentication. Most git servers will use HTTP basic authentication (user+passwords) even for OAuth tokens. Signed-off-by: Santiago M. Mola <[email protected]>
1 parent 3033d45 commit 8aab983

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

plumbing/transport/http/common.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,14 @@ func (a *BasicAuth) String() string {
214214
return fmt.Sprintf("%s - %s:%s", a.Name(), a.Username, masked)
215215
}
216216

217-
// TokenAuth implements the go-git http.AuthMethod and transport.AuthMethod interfaces
217+
// TokenAuth implements an http.AuthMethod that can be used with http transport
218+
// to authenticate with HTTP token authentication (also known as bearer
219+
// authentication).
220+
//
221+
// IMPORTANT: If you are looking to use OAuth tokens with popular servers (e.g.
222+
// GitHub, Bitbucket, GitLab) you should use BasicAuth instead. These servers
223+
// use basic HTTP authentication, with the OAuth token as user or password.
224+
// Check the documentation of your git server for details.
218225
type TokenAuth struct {
219226
Token string
220227
}

0 commit comments

Comments
 (0)