Documentation ¶
Index ¶
- Variables
- func DefaultBuild() module.Invoker
- type AuthInfo
- type BasicTokenInfo
- type BasicUserInfo
- type Client
- type GithubClient
- type InvokerCfg
- type QQClient
- func (c *QQClient) GetAccessToken(code string) (*BasicTokenInfo, error)
- func (c *QQClient) GetOpenID(accessToken string) (*AuthInfo, error)
- func (c *QQClient) GetType() string
- func (c *QQClient) GetUserInfo(accessToken string) (*BasicUserInfo, error)
- func (c *QQClient) LoginPage(state string) string
- type QQUserInfo
- type QQ_Error
- type SocialService
- type WxClient
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultInvokerCfg = InvokerCfg{ Debug: false, Mode: "", AppID: "", AppSecret: "", }
Functions ¶
Types ¶
type BasicTokenInfo ¶
type BasicTokenInfo struct {
AccessToken string
}
type BasicUserInfo ¶
type Client ¶
type Client struct { SocialService // contains filtered or unexported fields }
type GithubClient ¶
type GithubClient struct { AppID string AppSecret string AccessToken string OpenID string Name string RedirectURI string }
func (*GithubClient) GetAccessToken ¶
func (c *GithubClient) GetAccessToken(code string) (*BasicTokenInfo, error)
func (*GithubClient) GetType ¶
func (c *GithubClient) GetType() string
func (*GithubClient) GetUserInfo ¶
func (c *GithubClient) GetUserInfo(accessToken string) (*BasicUserInfo, error)
func (*GithubClient) LoginPage ¶
func (c *GithubClient) LoginPage(state string) string
get login page github state empty string
type InvokerCfg ¶
example * [beemod.oauth2.qq]
debug = true mode = "qq" app_id = "app_id" app_secret = "app_secret" redirectURI = "www.beego.com"
[beemod.oauth2.wx]
debug = true mode = "wx" app_id = "app_id" app_secret = "app_secret" redirectURI = "www.beego.com"
[beemod.oauth2.github]
debug = true mode = "github" app_id = "app_id" app_secret = "app_secret" redirectURI = "www.beego.com"
type QQClient ¶
func (*QQClient) GetAccessToken ¶
func (c *QQClient) GetAccessToken(code string) (*BasicTokenInfo, error)
get token
func (*QQClient) GetUserInfo ¶
func (c *QQClient) GetUserInfo(accessToken string) (*BasicUserInfo, error)
get userInfo
type QQUserInfo ¶
type QQUserInfo struct { Ret int64 `json:"ret"` // 返回代码 Msg string `json:"msg"` // 错误信息 Nickname string `json:"nickname"` // QQ空间的昵称 FigType string `json:"figureurl_type"` // 头像类型 Fig string `json:"figureurl"` // 30×30 像素空间头像 Fig1 string `json:"figureurl_1"` // 50×50 像素空间头像 Fig2 string `json:"figureurl_2"` // 100×100 像素空间头像 FigQQ string `json:"figureurl_qq"` // 640×640 QQ头像 FigQQ1 string `json:"figureurl_qq_1"` // 40×40 QQ头像 FigQQ2 string `json:"figureurl_qq_2"` // 100×100 QQ头像(可能为空) Gender string `json:"gender"` // 性别(未设置则返回“男”) GenderType int64 `json:"gender_type"` // 性别类型 Province string `json:"province"` // 省份 City string `json:"city"` // 城市 Year string `json:"year"` // 出生年份 Constellation string `json:"constellation"` // 星座 IsYellowVIP string `json:"is_yellow_vip"` // 是否为黄钻用户 IsYellowYearVIP string `json:"is_yellow_year_vip"` // 是否年费黄钻用户 YellowVIPLevel string `json:"yellow_vip_level"` // 黄钻登机 VIP string `json:"vip"` // 是非VIP Level string `json:"level"` // VIP等级 IsLost int64 `json:"is_lost"` // 未知 }
UserInfo get_user_info api response
type SocialService ¶
type SocialService interface { LoginPage(state string) string GetAccessToken(code string) (*BasicTokenInfo, error) GetUserInfo(accessToken string) (*BasicUserInfo, error) GetType() string }
func NewGithubOauth2Service ¶
func NewGithubOauth2Service(app_id, app_secret, redirectURI string) SocialService
func NewQQauth2Service ¶
func NewQQauth2Service(appID, appKey, redirectURI string) SocialService
func NewWxOauth2Service ¶
func NewWxOauth2Service(app_id, app_secret, redirectURI string) SocialService
type WxClient ¶
type WxClient struct { AppID string AppSecret string AccessToken string OpenID string Name string RedirectURI string }
func (*WxClient) GetAccessToken ¶
func (c *WxClient) GetAccessToken(code string) (*BasicTokenInfo, error)
func (*WxClient) GetUserInfo ¶
func (c *WxClient) GetUserInfo(accessToken string) (*BasicUserInfo, error)
Click to show internal directories.
Click to hide internal directories.