1 Star 0 Fork 0

扒拉扒拉 / wechat-sdk

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
oauth2.go 885 Bytes
一键复制 编辑 原始数据 按行查看 历史
夏雨天 提交于 2023-05-12 08:37 . init
package component
import (
"fmt"
"net/url"
)
// AuthCodeURL 生成网页授权地址.
// appId: 公众号的唯一标识
// componentAppId: 服务方的appid,在申请创建公众号服务成功后,可在公众号服务详情页找到
// redirectURI: 授权后重定向的回调链接地址
// scope: 应用授权作用域
// state: 重定向后会带上 state 参数, 开发者可以填写 a-zA-Z0-9 的参数值, 最多128字节
func AuthCodeURL(appId, componentAppId, redirectURI, scope, state string) string {
return fmt.Sprintf("https://open.weixin.qq.com/connect/oauth2/authorize?"+
"appid=%s&component_appid=%s&redirect_uri=%s&scope=%s&state=%s&response_type=code#wechat_redirect",
url.QueryEscape(appId),
url.QueryEscape(componentAppId),
url.QueryEscape(redirectURI),
url.QueryEscape(scope),
url.QueryEscape(state),
)
}
1
https://gitee.com/vibly/wechat-sdk.git
git@gitee.com:vibly/wechat-sdk.git
vibly
wechat-sdk
wechat-sdk
v1.0.0

搜索帮助

53164aa7 5694891 3bd8fe86 5694891