qq

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 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 AccessTokenResp

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

type AuthCodeResp

type AuthCodeResp struct {
	Code string `json:"code"`
	Msg  string `json:"msg"`
}

type OAuth

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

func New

func New(opts ...Option) *OAuth

func (*OAuth) GetAppId

func (auth *OAuth) GetAppId() string

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) (*AccessTokenResp, error)

GetToken 通过 code 获取 accessToken

func (*OAuth) Provide

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

type OpenidResp

type OpenidResp struct {
	ClientId string `json:"client_id"`
	Openid   string `json:"openid"`
}

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 WithProduct

func WithProduct(product bool) Option

func WithRedirectUri

func WithRedirectUri(redirectUri string) Option

type Options

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

Jump to

Keyboard shortcuts

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