7 Star 53 Fork 22

北京小程科技有限公司 / 支付宝

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
open_auth_token_app_url.go 1.12 KB
一键复制 编辑 原始数据 按行查看 历史
shallot 提交于 2020-11-02 13:35 . 拆分单个和批量授权URL。
package alipay
import (
"fmt"
"net/url"
"strings"
)
// 第三方应用授权URL,单个授权
// https://opendocs.alipay.com/open/20160728150111277227/intro
func GetOpenAuthTokenAppUrlSingle(isProd bool, appId string, redirectUri string) (result string) {
if isProd {
result += "https://openauth.alipay.com"
} else {
result += "https://openauth.alipaydev.com"
}
result += "/oauth2/appToAppAuth.htm"
result += fmt.Sprintf("?app_id=%s", appId)
result += fmt.Sprintf("&redirect_uri=%s", url.QueryEscape(redirectUri))
return
}
// 第三方应用授权URL,批量授权
// https://opendocs.alipay.com/open/20160728150111277227/intro
func GetOpenAuthTokenAppUrlBatch(
isProd bool,
appId string,
applicationTypes []string,
redirectUri string,
) (result string) {
if isProd {
result += "https://openauth.alipay.com"
} else {
result += "https://openauth.alipaydev.com"
}
result += "/oauth2/appToAppBatchAuth.htm"
result += fmt.Sprintf("?app_id=%s", appId)
result += fmt.Sprintf("&application_type=%s", strings.Join(applicationTypes, ","))
result += fmt.Sprintf("&redirect_uri=%s", url.QueryEscape(redirectUri))
return
}
Go
1
https://gitee.com/xiaochengtech/alipay.git
git@gitee.com:xiaochengtech/alipay.git
xiaochengtech
alipay
支付宝
master

搜索帮助