Merge pull request #371 from eddiezane/ez/update-new-from-token
Use StaticTokenSource with NewFromToken
This commit is contained in:
commit
bf5565cae5
5
godo.go
5
godo.go
|
@ -166,10 +166,7 @@ func addOptions(s string, opt interface{}) (string, error) {
|
||||||
// token.
|
// token.
|
||||||
func NewFromToken(token string) *Client {
|
func NewFromToken(token string) *Client {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
ts := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: token})
|
||||||
config := &oauth2.Config{}
|
|
||||||
ts := config.TokenSource(ctx, &oauth2.Token{AccessToken: token})
|
|
||||||
|
|
||||||
return NewClient(oauth2.NewClient(ctx, ts))
|
return NewClient(oauth2.NewClient(ctx, ts))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue