component

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthCodeURL

func AuthCodeURL(appId, componentAppId, redirectURI, scope, state string) string

AuthCodeURL 生成网页授权地址.

appId:          公众号的唯一标识
componentAppId: 服务方的appid,在申请创建公众号服务成功后,可在公众号服务详情页找到
redirectURI:    授权后重定向的回调链接地址
scope:          应用授权作用域
state:          重定向后会带上 state 参数, 开发者可以填写 a-zA-Z0-9 的参数值, 最多128字节

func GetSession

func GetSession(Endpoint *Endpoint, code string) (session *mpoauth2.Session, err error)

GetSession 获取小程序会话

func GetSessionWithClient

func GetSessionWithClient(Endpoint *Endpoint, code string, httpClient *http.Client) (session *mpoauth2.Session, err error)

GetSessionWithClient 获取小程序会话

Types

type Endpoint

type Endpoint struct {
	AppId                string
	ComponentAppId       string
	ComponentAccessToken string
}

Endpoint 实现了 wechat.v2/oauth2.Endpoint 接口.

func NewEndpoint

func NewEndpoint(appId, componentAppId, componentAccessToken string) *Endpoint

func (*Endpoint) ExchangeTokenURL

func (p *Endpoint) ExchangeTokenURL(code string) string

func (*Endpoint) LoginUrl

func (p *Endpoint) LoginUrl(preAuthCode string, redirectUri string, authType uint, bizAppId string) string

要授权的帐号类型, 1则商户扫码后,手机端仅展示公众号、2表示仅展示小程序,3表示公众号和小程序都展示。如果为未制定,则默认小程序和公众号都展示。第三方平台开发者可以使用本字段来控制授权的帐号类型。

func (*Endpoint) RefreshTokenURL

func (p *Endpoint) RefreshTokenURL(refreshToken string) string

func (*Endpoint) SessionCodeUrl

func (p *Endpoint) SessionCodeUrl(code string) string

Jump to

Keyboard shortcuts

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