Documentation
¶
Overview ¶
微信开放平台 移动应用、网站应用 微信登录功能 SDK.
Index ¶
- Constants
- func FastRegisterWxaLink(appId, componentAppid, redirectURI string) string
- func GetAuthAppInfo(clt *core.Client, appId string) (authorizer map[string]interface{}, authorization map[string]interface{}, ...)
- func GetPreAuthCode(clt *core.Client) (code string, err error)
- func OpenAuthWebURL(appId, redirectURI, preAuthCode string, authType int) string
- func OpenAuthWechatLink(appId, redirectURI, preAuthCode string, authType int) string
- func OpenAuthWechatNewLink(appId, redirectURI, preAuthCode string, authType int) string
- func WebAuth(accessToken, openId string, httpClient *http.Client) (valid bool, err error)
- func WebAuthCodeURL(appId, redirectURI, scope, state string) string
- func WxaCode2Session(clt *core.Client, appId, js_code string) (openid, unionid, session_key string, err error)
- type AuthorizationInfo
- type Endpoint
- type UserInfo
Constants ¶
View Source
const ( LanguageZhCN = mpoauth2.LanguageZhCN LanguageZhTW = mpoauth2.LanguageZhTW LanguageEN = mpoauth2.LanguageEN )
View Source
const ( SexUnknown = mpoauth2.SexUnknown SexMale = mpoauth2.SexMale SexFemale = mpoauth2.SexFemale )
Variables ¶
This section is empty.
Functions ¶
func FastRegisterWxaLink ¶
FastRegisterWxaLink 快速注册小程序的开放平台连接. appId: 公众号的 appid component_appid: 第三方平台的appid redirectURI: 授权后重定向的回调链接地址 公众号管理员扫码后在手机端完成授权确认。 跳转回第三方平台,会在上述 redirect_uri后拼接 ticket=*
func GetAuthAppInfo ¶
func GetAuthAppInfo(clt *core.Client, appId string) (authorizer map[string]interface{}, authorization map[string]interface{}, err error)
获取授权方的授权信息 获取授权app的具体信息
func GetPreAuthCode ¶
获取预授权码 配合 授权链接获取的authcode 一起服用, 换取token
func OpenAuthWebURL ¶
AuthWebURL 生成网页连接的开放平台授权地址.
appId: 开放平台 preAuthCode: 预授权code, 从平台获取
authType : 1则商户点击链接后,手机端仅展示公众号、2表示仅展示小程序,3表示公众号和小程序都展示。如果为未指定,则默认小程序和公众号都展示
redirectURI: 授权后重定向的回调链接地址
func OpenAuthWechatLink ¶
OpenAuthWechatLink 生成微信内点击的开放平台授权地址.
appId: 开放平台 preAuthCode: 预授权code, 从平台获取 authType : 1则商户点击链接后,手机端仅展示公众号、2表示仅展示小程序,3表示公众号和小程序都展示。如果为未指定,则默认小程序和公众号都展示 redirectURI: 授权后重定向的回调链接地址
func OpenAuthWechatNewLink ¶ added in v1.3.2
OpenAuthWechatLink 生成微信内点击的开放平台授权地址.
appId: 开放平台 preAuthCode: 预授权code, 从平台获取 authType : 1则商户点击链接后,手机端仅展示公众号、2表示仅展示小程序,3表示公众号和小程序都展示。如果为未指定,则默认小程序和公众号都展示 redirectURI: 授权后重定向的回调链接地址
func WebAuth ¶
Auth 检验授权凭证 access_token 是否有效.
accessToken: 网页授权接口调用凭证 openId: 用户的唯一标识 httpClient: 如果不指定则默认为 util.DefaultHttpClient
func WebAuthCodeURL ¶
WebAuthCodeURL 生成网页授权地址.
appId: 网页的唯一标识 redirectURI: 授权后重定向的回调链接地址 scope: 应用授权作用域 state: 重定向后会带上 state 参数, 开发者可以填写 a-zA-Z0-9 的参数值, 最多128字节
Types ¶
type AuthorizationInfo ¶
type AuthorizationInfo struct { AppId string `json:"authorizer_appid"` AccessToken string `json:"authorizer_access_token"` ExpiresIn int `json:"expires_in"` RefreshToken string `json:"authorizer_refresh_token"` FuncInfo []interface{} `json:"func_info"` }
func GetAuthInfo ¶
func GetAuthInfo(clt *core.Client, auth_code string) (authInfo AuthorizationInfo, err error)
获取授权信息 授权链接获取的authcode 一起服用, 换取token
func RefreshAuthInfo ¶
func RefreshAuthInfo(clt *core.Client, appId string, refreshToken string) (authInfo AuthorizationInfo, err error)
刷新第三方帐号的授权信息 注意: 此处appid和refresh token 均为第三方帐号的appid和refreshtoken, 不是开放平台的appid和token
type Endpoint ¶
func NewEndpoint ¶
func (*Endpoint) ExchangeTokenURL ¶
func (*Endpoint) RefreshTokenURL ¶
Click to show internal directories.
Click to hide internal directories.