qq

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OAuth

type OAuth struct {
	Conf *OAuthConfig
}

@ qq 结构 ------------------------------------------------- start

func NewAuth

func NewAuth(config *OAuthConfig) *OAuth

构造方法

func (*OAuth) AuthCodeURL

func (c *OAuth) AuthCodeURL(state string) string

获取登录地址

func (*OAuth) OpenInfo

func (c *OAuth) OpenInfo(access_token string, isUnion bool) (*OpenIDInfo, error)

获取第三方id

func (*OAuth) Token

func (c *OAuth) Token(code string) (*Token, error)

获取token

func (*OAuth) UserInfo

func (c *OAuth) UserInfo(access_token string, openid string) (*QQUserInfo, error)

获取第三方用户信息

type OpenIDInfo

type OpenIDInfo struct {
	Client_ID string `json:"client_id"`
	OpenID    string `json:"openid"`
	UnionID   string `json:"unionid",omitempty`
}

type QQUserInfo

type QQUserInfo struct {
	// 返回码
	Ret int `json:"ret"`
	// 如果ret<0,会有相应的错误信息提示,返回数据全部用UTF-8编码。
	Msg string `json:"msg",omitempty`
	// 用户在QQ空间的昵称。
	NickName string `json:"nickname",omitempty`
	// 大小为30×30像素的QQ空间头像URL。
	Figureurl string `json:"figureurl",omitempty`
	// 大小为50×50像素的QQ空间头像URL。
	Figureurl_1 string `json:"figureurl_1",omitempty`
	// 大小为100×100像素的QQ空间头像URL。
	Figureurl_2 string `json:"figureurl_2",omitempty`
	// 大小为40×40像素的QQ头像URL。
	Figureurl_qq_1 string `json:"figureurl_qq_1"`
	// 大小为100×100像素的QQ头像URL。需要注意,不是所有的用户都拥有QQ的100x100的头像,但40x40像素则是一定会有。
	Figureurl_qq_2 string `json:"figureurl_qq_2",omitempty`
	// 性别。 如果获取不到则默认返回"男"
	Gender string `json:"gender",omitempty`
}

type Token

type Token struct {
	// 授权令牌,Access_Token。
	AccessToken string `json:"access_token"` //授权令牌,Access_Token。

	// TokenType is the type of token.
	// The Type method returns either this or "Bearer", the default.
	TokenType string `json:"token_type,omitempty"`

	// 在授权自动续期步骤中,获取新的Access_Token时需要提供的参数。
	// 注:refresh_token仅一次有效
	RefreshToken string `json:"refresh_token,omitempty"`

	// 该access token的有效期,单位为秒。
	Expiry string `json:"expires_in,omitempty"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL