diff options
Diffstat (limited to 'auth/oauth.go')
| -rw-r--r-- | auth/oauth.go | 14 | 
1 files changed, 14 insertions, 0 deletions
| diff --git a/auth/oauth.go b/auth/oauth.go index 1f2884b..965c7cc 100644 --- a/auth/oauth.go +++ b/auth/oauth.go @@ -50,6 +50,20 @@ func NewRefreshTokenClient(clientId, clientSecret, refreshToken string) *http.Cl      )  } +func NewAccessTokenClient(clientId, clientSecret, accessToken string) *http.Client { +    conf := getConfig(clientId, clientSecret) + +    token := &oauth2.Token{ +        TokenType: "Bearer", +        AccessToken: accessToken, +    } + +    return oauth2.NewClient( +        oauth2.NoContext, +        conf.TokenSource(oauth2.NoContext, token), +    ) +} +  func getConfig(clientId, clientSecret string) *oauth2.Config {      return &oauth2.Config{          ClientID:     clientId, | 
