Merge pull request #371 from eddiezane/ez/update-new-from-token

Use StaticTokenSource with NewFromToken
This commit is contained in:
Ben Tranter 2020-10-01 11:09:35 -04:00 committed by GitHub
commit bf5565cae5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 4 deletions

View File

@ -166,10 +166,7 @@ func addOptions(s string, opt interface{}) (string, error) {
// token.
func NewFromToken(token string) *Client {
ctx := context.Background()
config := &oauth2.Config{}
ts := config.TokenSource(ctx, &oauth2.Token{AccessToken: token})
ts := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: token})
return NewClient(oauth2.NewClient(ctx, ts))
}