qq

package
v1.3.10 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	URL = "https://graph.qq.com/oauth2.0/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type OAuth

type OAuth struct {
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) *OAuth

func (*OAuth) GetAuthCode

func (auth *OAuth) GetAuthCode(state string) (string, error)

GetAuthCode 获取登录的 Auth code 返回登录扫码的 URL

func (*OAuth) GetOpenId

func (auth *OAuth) GetOpenId(accessToken string) (string, error)

GetOpenId 通过 accessToken 换取用户 openId

func (*OAuth) GetOpenIdWithAuthCode

func (auth *OAuth) GetOpenIdWithAuthCode(authCode string) (string, error)

GetOpenIdWithAuthCode 获取 auth code 直接获取用户 openid

func (*OAuth) GetToken

func (auth *OAuth) GetToken(code string) (*PrivateInfo, error)

GetToken 通过 code 获取 accessToken

func (*OAuth) Provide

func (auth *OAuth) Provide(ctx context.Context) interface{}

type Option

type Option func(*Options)

func WithAppId

func WithAppId(appId string) Option

func WithAppKey

func WithAppKey(appKey string) Option

func WithDisplay

func WithDisplay(display string) Option

func WithNotify added in v1.3.1

func WithNotify(notify string) Option

func WithProduct

func WithProduct(product bool) Option

type Options

type Options struct {
	AppId   string
	AppKey  string
	Notify  string
	Display string
	Product bool
}

type PrivateInfo added in v1.3.0

type PrivateInfo struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ExpiresIn    string `json:"expires_in"`
}

Jump to

Keyboard shortcuts

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