Skip to content

Commit 52fb559

Browse files
larrycleanhousemeCopilot
authored
修改最新版本的授权地址 (#823)
* Update accessToken.go add openplatform refresh_token * Update accessToken.go openplatform add refresh_token expire set 10 year * Update openplatform/context/accessToken.go Co-authored-by: Copilot <[email protected]> * Update accessToken.go 修改最新的授权H5链接地址 * Update accessToken.go 增加新版本授权链接 * Update accessToken.go 增加新版本授权链接 --------- Co-authored-by: houseme <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 44150c5 commit 52fb559

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

openplatform/context/accessToken.go

+15
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const (
2020
getComponentInfoURL = "https://api.weixin.qq.com/cgi-bin/component/api_get_authorizer_info?component_access_token=%s"
2121
componentLoginURL = "https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=%s&pre_auth_code=%s&redirect_uri=%s&auth_type=%d&biz_appid=%s"
2222
bindComponentURL = "https://mp.weixin.qq.com/safe/bindcomponent?action=bindcomponent&auth_type=%d&no_scan=1&component_appid=%s&pre_auth_code=%s&redirect_uri=%s&biz_appid=%s#wechat_redirect"
23+
bindComponentURLV2 = "https://open.weixin.qq.com/wxaopen/safe/bindcomponent?action=bindcomponent&auth_type=%d&no_scan=1&component_appid=%s&pre_auth_code=%s&redirect_uri=%s&biz_appid=%s#wechat_redirect"
2324
// TODO 获取授权方选项信息
2425
// getComponentConfigURL = "https://api.weixin.qq.com/cgi-bin/component/api_get_authorizer_option?component_access_token=%s"
2526
// TODO 获取已授权的账号信息
@@ -137,6 +138,20 @@ func (ctx *Context) GetBindComponentURL(redirectURI string, authType int, bizApp
137138
return ctx.GetBindComponentURLContext(context.Background(), redirectURI, authType, bizAppID)
138139
}
139140

141+
// GetBindComponentURLV2Context 获取新版本第三方公众号授权链接(链接跳转,适用移动端)
142+
func (ctx *Context) GetBindComponentURLV2Context(stdCtx context.Context, redirectURI string, authType int, bizAppID string) (string, error) {
143+
code, err := ctx.GetPreCodeContext(stdCtx)
144+
if err != nil {
145+
return "", err
146+
}
147+
return fmt.Sprintf(bindComponentURLV2, authType, ctx.AppID, code, url.QueryEscape(redirectURI), bizAppID), nil
148+
}
149+
150+
// GetBindComponentURLV2 获取新版本第三方公众号授权链接(链接跳转,适用移动端)
151+
func (ctx *Context) GetBindComponentURLV2(redirectURI string, authType int, bizAppID string) (string, error) {
152+
return ctx.GetBindComponentURLContext(context.Background(), redirectURI, authType, bizAppID)
153+
}
154+
140155
// ID 微信返回接口中各种类型字段
141156
type ID struct {
142157
ID int `json:"id"`

0 commit comments

Comments
 (0)