wxchat

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2022 License: MulanPSL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScopeSnsBase = "snsapi_base"
	ScopeSnsInfo = "snsapi_userinfo"
)

scope 静默授权与用户授权

Variables

This section is empty.

Functions

func Run

func Run()

Types

type AccessToken

type AccessToken interface {
	// contains filtered or unexported methods
}

AccessToken 全局token

func NewAccessToken

func NewAccessToken() AccessToken

type Authorize

type Authorize interface {
	// SnsApiBase 静默授权
	SnsApiBase(redirectUri, state string) (string, error)
	// SnsApiUserInfo 用户授权
	SnsApiUserInfo(redirectUri, state string) (string, error)
	// SnsAccessToken code换取access_token
	SnsAccessToken(code string) (AuthorizeDTO, error)
	// SnsAuthAccessToken 验证access_token
	SnsAuthAccessToken() error
	// SnsRefreshToken 刷新access_token
	SnsRefreshToken() (AuthorizeDTO, error)
	// SnsUserInfo 拉取用户信息
	SnsUserInfo() (UserInfoDTO, error)
}

Authorize 网页授权相关接口

func NewAuthorize

func NewAuthorize() Authorize

type AuthorizeDTO

type AuthorizeDTO struct {
	AccessToken  string `json:"access_token"`
	ExpiresIn    int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	Openid       string `json:"openid"`
	Scope        string `json:"scope"`
}

type JsSdkDTO

type JsSdkDTO struct {
	AppId     string `json:"appid"`
	Noncestr  string `json:"noncestr"`
	Timestamp string `json:"timestamp"`
	Signature string `json:"signature"`
}

type JsapiTicket

type JsapiTicket interface {
	GetJsSdk(url string) JsSdkDTO
	// contains filtered or unexported methods
}

func NewJsapiTicket

func NewJsapiTicket() JsapiTicket

type UserInfoDTO

type UserInfoDTO struct {
	Openid     string   `json:"openid"`
	Nickname   string   `json:"nickname"`
	Sex        int      `json:"sex"`
	Province   string   `json:"province"`
	City       string   `json:"city"`
	Country    string   `json:"country"`
	Headimgurl string   `json:"headimgurl"`
	Privilege  []string `json:"privilege"`
	Unionid    string   `json:"unionid"`
}

Jump to

Keyboard shortcuts

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