Documentation ¶
Index ¶
- Constants
- type OAuthAccessToken
- type OAuthGithub
- type OAuthInterface
- type OAuthQQ
- func (o *OAuthQQ) AccessToken(code, state, callback string) (OAuthAccessToken, error)
- func (o *OAuthQQ) Authorize(state, callback string) string
- func (o *OAuthQQ) GetOpenID(accessToken string) (string, error)
- func (o *OAuthQQ) GetOpenIDUnionID(accessToken string) (openid, unionid string, err error)
- func (o *OAuthQQ) Userinfo(accessToken, openID string) (OAuthUserinfo, error)
- type OAuthUserinfo
- type OAuthWechat
- type OAuthWeibo
Constants ¶
const ( OAuthUserGenderFemale int = iota // Female OAuthUserGenderMale // male OAuthUserGenderUnknown // unknown // oauth user platform OAuthUserPlatformWechat = "wechat" // wechat OAuthUserPlatformWeibo = "weibo" // weibo OAuthUserPlatformQQ = "qq" // qq OAuthUserPlatformGithub = "github" // github )
user gender
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OAuthAccessToken ¶
type OAuthAccessToken struct { AccessToken string `json:"access_token"` OpenID string `json:"openid"` UnionID string `json:"unionid"` }
OAuthAccessToken access token
type OAuthGithub ¶
OAuthGithub oauth github
func NewOAuthGithub ¶
func NewOAuthGithub(id, secret string) *OAuthGithub
NewOAuthGithub return *OAuthGithub
func (*OAuthGithub) AccessToken ¶
func (o *OAuthGithub) AccessToken(code, state, callback string) (OAuthAccessToken, error)
AccessToken for github to get access token
func (*OAuthGithub) Authorize ¶
func (o *OAuthGithub) Authorize(state, callback string) string
Authorize for github
func (*OAuthGithub) Userinfo ¶
func (o *OAuthGithub) Userinfo(accessToken, openID string) (OAuthUserinfo, error)
Userinfo for github by access token
type OAuthInterface ¶
type OAuthInterface interface { Authorize(state, callback string) string AccessToken(code, state, callback string) (OAuthAccessToken, error) Userinfo(accessToken, openID string) (OAuthUserinfo, error) }
OAuthInterface interface
type OAuthQQ ¶
OAuthQQ oauth qq
func (*OAuthQQ) AccessToken ¶
func (o *OAuthQQ) AccessToken(code, state, callback string) (OAuthAccessToken, error)
AccessToken for qq to get access token
func (*OAuthQQ) GetOpenIDUnionID ¶
GetOpenIDUnionID return openid unionid by accesstoken
type OAuthUserinfo ¶
type OAuthUserinfo struct { Platform string `json:"platform"` Name string `json:"name"` OpenID string `json:"openid"` UnionID string `json:"unionid"` Avatar string `json:"avatar"` Gender int `json:"gender"` Detail string `json:"-"` }
OAuthUserinfo common struct
type OAuthWechat ¶
OAuthWechat oauth wechat
func NewOAuthWechat ¶
func NewOAuthWechat(id, secret string) *OAuthWechat
NewOAuthWechat return *OAuthWechat
func (*OAuthWechat) AccessToken ¶
func (o *OAuthWechat) AccessToken(code, state, callback string) (OAuthAccessToken, error)
AccessToken for wechat to get access token
func (*OAuthWechat) Authorize ¶
func (o *OAuthWechat) Authorize(state, callback string) string
Authorize for wechat
func (*OAuthWechat) Userinfo ¶
func (o *OAuthWechat) Userinfo(accessToken, openID string) (OAuthUserinfo, error)
Userinfo for wechat to get access token
type OAuthWeibo ¶
OAuthWeibo oauth weibo
func NewOAuthWeibo ¶
func NewOAuthWeibo(id, secret string) *OAuthWeibo
NewOAuthWeibo return *OAuthWeibo
func (*OAuthWeibo) AccessToken ¶
func (o *OAuthWeibo) AccessToken(code, state, callback string) (OAuthAccessToken, error)
AccessToken for weibo to get access token
func (*OAuthWeibo) Authorize ¶
func (o *OAuthWeibo) Authorize(state, callback string) string
Authorize for weibo
func (*OAuthWeibo) Userinfo ¶
func (o *OAuthWeibo) Userinfo(accessToken, openID string) (OAuthUserinfo, error)
Userinfo for weibo to get access token