// Authorize completes the the authorization with Spotify and returns 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")) if err != nil { return "", err } s.AccessToken = token.AccessToken return token.AccessToken, err }
// Authorize the session with Twitter 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) accessToken, err := p.consumer.AuthorizeToken(s.RequestToken, params.Get("oauth_verifier")) if err != nil { return "", err } s.AccessToken = accessToken return accessToken.Token, err }
// Authorize the session with LastFM 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) sess, err := p.GetSession(params.Get("token")) if err != nil { return "", err } s.AccessToken = sess["token"] s.Login = sess["login"] return sess["token"], err }