本文整理汇总了Golang中github.com/markbates/goth.Params.Get方法的典型用法代码示例。如果您正苦于以下问题:Golang Params.Get方法的具体用法?Golang Params.Get怎么用?Golang Params.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/markbates/goth.Params
的用法示例。
在下文中一共展示了Params.Get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Authorize
// 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"))
if err != nil {
return "", err
}
s.Token = token.AccessToken
return token.AccessToken, nil
}
示例2: Authorize
// 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
}
示例3: Authorize
// 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
}
示例4: Authorize
// 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"))
if err != nil {
return "", err
}
if !token.Valid() {
return "", errors.New("Invalid token received from provider")
}
s.Token = token.AccessToken
return token.AccessToken, nil
}
示例5: Authorize
// 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)
token, err := p.config.Exchange(ctx, params.Get("code"))
if err != nil {
return "", err
}
if !token.Valid() {
return "", errors.New("Invalid token received from provider")
}
s.AccessToken = token.AccessToken
s.RefreshToken = token.RefreshToken
s.ExpiresAt = token.Expiry
return token.AccessToken, err
}
示例6: Authorize
// 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"))
if err != nil {
return "", err
}
if !token.Valid() {
return "", errors.New("Invalid token received from provider")
}
s.AccessToken = token.AccessToken
s.RefreshToken = token.RefreshToken
s.ExpiresAt = token.Expiry
s.ID = token.Extra("stripe_user_id").(string) //Required to get the user info from sales force
return token.AccessToken, err
}