Skip to content

Commit

Permalink
Use httpClient field in context for oauth2 calls
Browse files Browse the repository at this point in the history
  • Loading branch information
felixLam committed Jun 24, 2016
1 parent 772461b commit e3a162c
Show file tree
Hide file tree
Showing 44 changed files with 58 additions and 48 deletions.
17 changes: 15 additions & 2 deletions provider.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
package goth

import "fmt"
import "golang.org/x/oauth2"
import (
"fmt"
"net/http"

"golang.org/x/net/context"
"golang.org/x/oauth2"
)

// Provider needs to be implemented for each 3rd party authentication provider
// e.g. Facebook, Twitter, etc...
Expand Down Expand Up @@ -47,3 +52,11 @@ func GetProvider(name string) (Provider, error) {
func ClearProviders() {
providers = Providers{}
}

// ContextForClient provides a context for use with oauth2.
func ContextForClient(h *http.Client) context.Context {
if h == nil {
return oauth2.NoContext
}
return context.WithValue(oauth2.NoContext, oauth2.HTTPClient, h)
}
2 changes: 1 addition & 1 deletion providers/amazon/amazon.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func (p *Provider) RefreshTokenAvailable() bool {
//RefreshToken get new access token based on the refresh token
func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) {
token := &oauth2.Token{RefreshToken: refreshToken}
ts := p.config.TokenSource(oauth2.NoContext, token)
ts := p.config.TokenSource(goth.ContextForClient(p.Client), token)
newToken, err := ts.Token()
if err != nil {
return nil, err
Expand Down
3 changes: 1 addition & 2 deletions providers/amazon/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/json"
"errors"
"github.com/markbates/goth"
"golang.org/x/oauth2"
"strings"
"time"
)
Expand All @@ -30,7 +29,7 @@ func (s Session) GetAuthURL() (string, error) {
// Authorize the session with Amazon and return the access token to be stored for future use.
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
p := provider.(*Provider)
token, err := p.config.Exchange(oauth2.NoContext, params.Get("code"))
token, err := p.config.Exchange(goth.ContextForClient(p.Client), params.Get("code"))
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion providers/bitbucket/bitbucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (p *Provider) RefreshTokenAvailable() bool {
//RefreshToken get new access token based on the refresh token
func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) {
token := &oauth2.Token{RefreshToken: refreshToken}
ts := p.config.TokenSource(oauth2.NoContext, token)
ts := p.config.TokenSource(goth.ContextForClient(p.Client), token)
newToken, err := ts.Token()
if err != nil {
return nil, err
Expand Down
3 changes: 1 addition & 2 deletions providers/bitbucket/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/json"
"errors"
"github.com/markbates/goth"
"golang.org/x/oauth2"
"strings"
"time"
)
Expand All @@ -28,7 +27,7 @@ func (s Session) GetAuthURL() (string, error) {
// Authorize the session with Bitbucket and return the access token to be stored for future use.
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
p := provider.(*Provider)
token, err := p.config.Exchange(oauth2.NoContext, params.Get("code"))
token, err := p.config.Exchange(goth.ContextForClient(p.Client), params.Get("code"))
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion providers/box/box.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (p *Provider) RefreshTokenAvailable() bool {
//RefreshToken get new access token based on the refresh token
func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) {
token := &oauth2.Token{RefreshToken: refreshToken}
ts := p.config.TokenSource(oauth2.NoContext, token)
ts := p.config.TokenSource(goth.ContextForClient(p.Client), token)
newToken, err := ts.Token()
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion providers/box/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (s Session) GetAuthURL() (string, error) {
// Authorize the session with Box and return the access token to be stored for future use.
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
p := provider.(*Provider)
token, err := p.config.Exchange(oauth2.NoContext, params.Get("code"))
token, err := p.config.Exchange(goth.ContextForClient(p.Client), params.Get("code"))
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion providers/cloudfoundry/cf.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func (p *Provider) RefreshTokenAvailable() bool {
//RefreshToken get new access token based on the refresh token
func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) {
token := &oauth2.Token{RefreshToken: refreshToken}
ctx := context.WithValue(oauth2.NoContext, oauth2.HTTPClient, p.httpClient())
ctx := context.WithValue(goth.ContextForClient(p.Client), oauth2.HTTPClient, p.httpClient())
ts := p.config.TokenSource(ctx, token)
newToken, err := ts.Token()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion providers/cloudfoundry/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (s Session) GetAuthURL() (string, error) {
// Authorize the session with Cloud Foundry and return the access token to be stored for future use.
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
p := provider.(*Provider)
ctx := context.WithValue(oauth2.NoContext, oauth2.HTTPClient, p.Client)
ctx := context.WithValue(goth.ContextForClient(p.Client), oauth2.HTTPClient, p.Client)
token, err := p.config.Exchange(ctx, params.Get("code"))
if err != nil {
return "", err
Expand Down
2 changes: 1 addition & 1 deletion providers/digitalocean/digitalocean.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func (p *Provider) RefreshTokenAvailable() bool {
//RefreshToken get new access token based on the refresh token
func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) {
token := &oauth2.Token{RefreshToken: refreshToken}
ts := p.config.TokenSource(oauth2.NoContext, token)
ts := p.config.TokenSource(goth.ContextForClient(p.Client), token)
newToken, err := ts.Token()
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion providers/digitalocean/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (s Session) GetAuthURL() (string, error) {
// Authorize the session with DigitalOcean and return the access token to be stored for future use.
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
p := provider.(*Provider)
token, err := p.config.Exchange(oauth2.NoContext, params.Get("code"))
token, err := p.config.Exchange(goth.ContextForClient(p.Client), params.Get("code"))
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion providers/dropbox/dropbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (s *Session) GetAuthURL() (string, error) {
// Authorize the session with Dropbox and return the access token to be stored for future use.
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
p := provider.(*Provider)
token, err := p.config.Exchange(oauth2.NoContext, params.Get("code"))
token, err := p.config.Exchange(goth.ContextForClient(p.Client), params.Get("code"))
if err != nil {
return "", err
}
Expand Down
3 changes: 1 addition & 2 deletions providers/facebook/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/json"
"errors"
"github.com/markbates/goth"
"golang.org/x/oauth2"
"strings"
"time"
)
Expand All @@ -27,7 +26,7 @@ func (s Session) GetAuthURL() (string, error) {
// Authorize the session with Facebook and return the access token to be stored for future use.
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
p := provider.(*Provider)
token, err := p.config.Exchange(oauth2.NoContext, params.Get("code"))
token, err := p.config.Exchange(goth.ContextForClient(p.Client), params.Get("code"))
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion providers/github/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (s Session) GetAuthURL() (string, error) {
// Authorize the session with Github and return the access token to be stored for future use.
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
p := provider.(*Provider)
token, err := p.config.Exchange(oauth2.NoContext, params.Get("code"))
token, err := p.config.Exchange(goth.ContextForClient(p.Client), params.Get("code"))
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion providers/gitlab/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func (p *Provider) RefreshTokenAvailable() bool {
//RefreshToken get new access token based on the refresh token
func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) {
token := &oauth2.Token{RefreshToken: refreshToken}
ts := p.config.TokenSource(oauth2.NoContext, token)
ts := p.config.TokenSource(goth.ContextForClient(p.Client), token)
newToken, err := ts.Token()
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion providers/gitlab/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (s Session) GetAuthURL() (string, error) {
// Authorize the session with Gitlab and return the access token to be stored for future use.
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
p := provider.(*Provider)
token, err := p.config.Exchange(oauth2.NoContext, params.Get("code"))
token, err := p.config.Exchange(goth.ContextForClient(p.Client), params.Get("code"))
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion providers/gplus/gplus.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (p *Provider) RefreshTokenAvailable() bool {
//RefreshToken get new access token based on the refresh token
func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) {
token := &oauth2.Token{RefreshToken: refreshToken}
ts := p.config.TokenSource(oauth2.NoContext, token)
ts := p.config.TokenSource(goth.ContextForClient(p.Client), token)
newToken, err := ts.Token()
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion providers/gplus/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (s Session) GetAuthURL() (string, error) {
// Authorize the session with Google+ and return the access token to be stored for future use.
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
p := provider.(*Provider)
token, err := p.config.Exchange(oauth2.NoContext, params.Get("code"))
token, err := p.config.Exchange(goth.ContextForClient(p.Client), params.Get("code"))
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion providers/heroku/heroku.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (p *Provider) RefreshTokenAvailable() bool {
//RefreshToken get new access token based on the refresh token
func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) {
token := &oauth2.Token{RefreshToken: refreshToken}
ts := p.config.TokenSource(oauth2.NoContext, token)
ts := p.config.TokenSource(goth.ContextForClient(p.Client), token)
newToken, err := ts.Token()
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion providers/heroku/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (s Session) GetAuthURL() (string, error) {
// Authorize the session with Heroku and return the access token to be stored for future use.
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
p := provider.(*Provider)
token, err := p.config.Exchange(oauth2.NoContext, params.Get("code"))
token, err := p.config.Exchange(goth.ContextForClient(p.Client), params.Get("code"))
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion providers/influxcloud/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func (s Session) GetAuthURL() (string, error) {
// Authorize the session with Github and return the access token to be stored for future use.
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
p := provider.(*Provider)
token, err := p.config.Exchange(oauth2.NoContext, params.Get("code"))
token, err := p.config.Exchange(goth.ContextForClient(p.Client), params.Get("code"))
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion providers/instagram/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (s Session) GetAuthURL() (string, error) {
// Authorize the session with Instagram and return the access token to be stored for future use.
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
p := provider.(*Provider)
token, err := p.config.Exchange(oauth2.NoContext, params.Get("code"))
token, err := p.config.Exchange(goth.ContextForClient(p.Client), params.Get("code"))
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion providers/linkedin/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func (s Session) GetAuthURL() (string, error) {
// Authorize the session with Linkedin and return the access token to be stored for future use.
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
p := provider.(*Provider)
token, err := p.config.Exchange(oauth2.NoContext, params.Get("code"))
token, err := p.config.Exchange(goth.ContextForClient(p.Client), params.Get("code"))
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion providers/onedrive/onedrive.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (p *Provider) RefreshTokenAvailable() bool {
//RefreshToken get new access token based on the refresh token
func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) {
token := &oauth2.Token{RefreshToken: refreshToken}
ts := p.config.TokenSource(oauth2.NoContext, token)
ts := p.config.TokenSource(goth.ContextForClient(p.Client), token)
newToken, err := ts.Token()
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion providers/onedrive/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (s Session) GetAuthURL() (string, error) {
// Authorize the session with Box and return the access token to be stored for future use.
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
p := provider.(*Provider)
token, err := p.config.Exchange(oauth2.NoContext, params.Get("code"))
token, err := p.config.Exchange(goth.ContextForClient(p.Client), params.Get("code"))
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion providers/paypal/paypal.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func (p *Provider) RefreshTokenAvailable() bool {
//RefreshToken get new access token based on the refresh token
func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) {
token := &oauth2.Token{RefreshToken: refreshToken}
ts := p.config.TokenSource(oauth2.NoContext, token)
ts := p.config.TokenSource(goth.ContextForClient(p.Client), token)
newToken, err := ts.Token()
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion providers/paypal/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (s Session) GetAuthURL() (string, error) {
// Authorize the session with Paypal and return the access token to be stored for future use.
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
p := provider.(*Provider)
token, err := p.config.Exchange(oauth2.NoContext, params.Get("code"))
token, err := p.config.Exchange(goth.ContextForClient(p.Client), params.Get("code"))
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion providers/salesforce/salesforce.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func (p *Provider) RefreshTokenAvailable() bool {
//RefreshToken get new access token based on the refresh token
func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) {
token := &oauth2.Token{RefreshToken: refreshToken}
ts := p.config.TokenSource(oauth2.NoContext, token)
ts := p.config.TokenSource(goth.ContextForClient(p.Client), token)
newToken, err := ts.Token()
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion providers/salesforce/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (s Session) GetAuthURL() (string, error) {
// Authorize the session with Salesforce and return the access token to be stored for future use.
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
p := provider.(*Provider)
token, err := p.config.Exchange(oauth2.NoContext, params.Get("code"))
token, err := p.config.Exchange(goth.ContextForClient(p.Client), params.Get("code"))

if err != nil {
return "", err
Expand Down
2 changes: 1 addition & 1 deletion providers/slack/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (s Session) GetAuthURL() (string, error) {
// Authorize the session with Slack and return the access token to be stored for future use.
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
p := provider.(*Provider)
token, err := p.config.Exchange(oauth2.NoContext, params.Get("code"))
token, err := p.config.Exchange(goth.ContextForClient(p.Client), params.Get("code"))
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion providers/soundcloud/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (s Session) GetAuthURL() (string, error) {
// Authorize the session with Soundcloud and return the access token to be stored for future use.
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
p := provider.(*Provider)
token, err := p.config.Exchange(oauth2.NoContext, params.Get("code"))
token, err := p.config.Exchange(goth.ContextForClient(p.Client), params.Get("code"))
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion providers/soundcloud/soundcloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (p *Provider) RefreshTokenAvailable() bool {
//RefreshToken get new access token based on the refresh token
func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) {
token := &oauth2.Token{RefreshToken: refreshToken}
ts := p.config.TokenSource(oauth2.NoContext, token)
ts := p.config.TokenSource(goth.ContextForClient(p.Client), token)
newToken, err := ts.Token()
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion providers/spotify/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (s Session) GetAuthURL() (string, error) {
// token to be stored for future use.
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
p := provider.(*Provider)
token, err := p.config.Exchange(oauth2.NoContext, params.Get("code"))
token, err := p.config.Exchange(goth.ContextForClient(p.Client), params.Get("code"))
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion providers/spotify/spotify.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func (p *Provider) RefreshTokenAvailable() bool {
//RefreshToken get new access token based on the refresh token
func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) {
token := &oauth2.Token{RefreshToken: refreshToken}
ts := p.config.TokenSource(oauth2.NoContext, token)
ts := p.config.TokenSource(goth.ContextForClient(p.Client), token)
newToken, err := ts.Token()
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion providers/stripe/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (s Session) GetAuthURL() (string, error) {
// Authorize the session with Stripe and return the access token to be stored for future use.
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
p := provider.(*Provider)
token, err := p.config.Exchange(oauth2.NoContext, params.Get("code"))
token, err := p.config.Exchange(goth.ContextForClient(p.Client), params.Get("code"))
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion providers/stripe/stripe.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (p *Provider) RefreshTokenAvailable() bool {
//RefreshToken get new access token based on the refresh token
func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) {
token := &oauth2.Token{RefreshToken: refreshToken}
ts := p.config.TokenSource(oauth2.NoContext, token)
ts := p.config.TokenSource(goth.ContextForClient(p.Client), token)
newToken, err := ts.Token()
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion providers/twitch/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (s Session) GetAuthURL() (string, error) {
// token to be stored for future use.
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
p := provider.(*Provider)
token, err := p.config.Exchange(oauth2.NoContext, params.Get("code"))
token, err := p.config.Exchange(goth.ContextForClient(p.Client), params.Get("code"))
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion providers/twitch/twitch.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func (p *Provider) RefreshTokenAvailable() bool {
//RefreshToken get new access token based on the refresh token
func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) {
token := &oauth2.Token{RefreshToken: refreshToken}
ts := p.config.TokenSource(oauth2.NoContext, token)
ts := p.config.TokenSource(goth.ContextForClient(p.Client), token)
newToken, err := ts.Token()
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion providers/uber/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (s Session) GetAuthURL() (string, error) {
// Authorize the session with Uber and return the access token to be stored for future use.
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
p := provider.(*Provider)
token, err := p.config.Exchange(oauth2.NoContext, params.Get("code"))
token, err := p.config.Exchange(goth.ContextForClient(p.Client), params.Get("code"))
if err != nil {
return "", err
}
Expand Down
Loading

0 comments on commit e3a162c

Please sign in to comment.