Documentation ¶
Index ¶
- Variables
- func AuthCodeURL(c *oauth2.Config, state string, opts ...toauth2.AuthCodeOption) string
- func Exchange(ctx context.Context, c *oauth2.Config, code string, ...) (*oauth2.Token, error)
- func GetOpenID(ctx context.Context, token *oauth2.Token) (string, error)
- func GetUnionID(ctx context.Context, token *oauth2.Token) (string, error)
- func GetUserID(ctx context.Context, token *oauth2.Token) (toauth2.UserID, error)
- func RefreshToken(ctx context.Context, c *oauth2.Config, refreshToken string) (*oauth2.Token, error)
- type Provider
- func (p *Provider) AuthCodeURLOptions(options ...toauth2.AuthCodeOption)
- func (p *Provider) BeginAuth(state string) (goth.Session, error)
- func (p *Provider) Client() *http.Client
- func (p *Provider) Debug(debug bool)
- func (p *Provider) ExchangeOptions(options ...toauth2.AuthCodeOption)
- func (p *Provider) FetchUser(session goth.Session) (goth.User, error)
- func (p *Provider) Name() string
- func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error)
- func (p *Provider) RefreshTokenAvailable() bool
- func (p *Provider) SetName(name string)
- func (p *Provider) UnmarshalSession(data string) (goth.Session, error)
- func (p *Provider) UserInfoOptions(options ...toauth2.AuthCodeOption)
- type Session
- type User
Constants ¶
This section is empty.
Variables ¶
var ( AuthURL = "https://graph.qq.com/oauth2.0/authorize" TokenURL = "https://graph.qq.com/oauth2.0/token" OpenIDURL = "https://graph.qq.com/oauth2.0/me" UserInfoURL = "https://graph.qq.com/user/get_user_info" )
Functions ¶
func AuthCodeURL ¶
func GetUnionID ¶ added in v0.2.0
Types ¶
type Provider ¶ added in v0.1.5
type Provider struct { ClientKey string Secret string CallbackURL string HTTPClient *http.Client // contains filtered or unexported fields }
Provider is the implementation of `goth.Provider` for accessing QQ.
func New ¶ added in v0.1.5
New creates a new QQ provider and sets up important connection details. You should always call `qq.New` to get a new provider. Never try to create one manually.
func NewCustomisedURL ¶ added in v0.1.5
func NewCustomisedURL(clientKey, secret, callbackURL, authURL, tokenURL, openIDURL, userInfoURL string, scopes ...string) *Provider
NewCustomisedURL is similar to New(...) but can be used to set custom URLs to connect to
func (*Provider) AuthCodeURLOptions ¶ added in v0.1.5
func (p *Provider) AuthCodeURLOptions(options ...toauth2.AuthCodeOption)
func (*Provider) ExchangeOptions ¶ added in v0.1.5
func (p *Provider) ExchangeOptions(options ...toauth2.AuthCodeOption)
func (*Provider) FetchUser ¶ added in v0.1.5
FetchUser will go to QQ and access basic information about the user.
func (*Provider) RefreshToken ¶ added in v0.1.5
RefreshToken get new access token based on the refresh token
func (*Provider) RefreshTokenAvailable ¶ added in v0.1.5
RefreshTokenAvailable refresh token is provided by auth provider or not
func (*Provider) SetName ¶ added in v0.1.5
SetName is to update the name of the provider (needed in case of multiple providers of 1 type)
func (*Provider) UnmarshalSession ¶ added in v0.1.5
UnmarshalSession wil unmarshal a JSON string into a session.
func (*Provider) UserInfoOptions ¶ added in v0.1.5
func (p *Provider) UserInfoOptions(options ...toauth2.AuthCodeOption)
type Session ¶ added in v0.1.5
type Session struct { AuthURL string AccessToken string RefreshToken string ExpiresAt time.Time OpenID string UnionID string }
func (*Session) Authorize ¶ added in v0.1.5
Authorize the session with Wechat and return the access token to be stored for future use.
func (Session) GetAuthURL ¶ added in v0.1.5
GetAuthURL will return the URL set by calling the `BeginAuth` function on the Wechat provider.