Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTokenFromServer ¶
GetTokenFromServer 强制从微信服务器获取token
Types ¶
type BaseHandler ¶
type BaseHandler struct {
// contains filtered or unexported fields
}
type CommonError ¶
type MiniAccessToken ¶
type MiniAccessToken struct {
// contains filtered or unexported fields
}
func (*MiniAccessToken) AuthorizeCode ¶
func (ak *MiniAccessToken) AuthorizeCode(code string) (accessToken WxMiniLoginResp, err error)
AuthorizeCode 获取access_token,先从cache中获取,没有则从服务端获取
func (*MiniAccessToken) Credentials ¶
func (ak *MiniAccessToken) Credentials() (accessToken string, err error)
type Oauth2Handle ¶
type Oauth2Handle interface {
// Credentials 直接换取accessToken(服务器对服务器应用)
Credentials() (accessToken string, err error)
// AuthorizeCode 微信登录
AuthorizeCode(code string) (accessToken WxMiniLoginResp, err error)
}
func New ¶
func New(opts ...Option) Oauth2Handle
type Option ¶
type Option func(handler *BaseHandler)
type ResAccessToken ¶
type ResAccessToken struct {
CommonError
AccessToken string `json:"access_token"`
ExpiresIn int64 `json:"expires_in"`
}
ResAccessToken struct
type WxMiniLoginResp ¶
type WxMiniLoginResp struct {
SessionKey string `json:"session_Key,omitempty"`
UnionId string `json:"unionid,omitempty"`
OpenId string `json:"openid,omitempty"`
CommonError
}
Click to show internal directories.
Click to hide internal directories.