https://www.xxxx.com/default.html 为例。
https://openauth-sandbox.dl.alipaydev.com/oauth2/publicAppAuthorize.htm?app_id=APPID&scope=SCOPE&redirect_uri=ENCODED_URL| 参数名 | 是否必须 | 描述 |
|---|---|---|
| app_id | 是 | 开发者应用的 APPID |
| scope | 是 | 接口权限值,目前只支持 auth_user 和 auth_base 两个值 |
| redirect_uri | 是 | 回调页面,是经过转义的 url 链接(url 必须以 http 或者 https 开头),比如:http%3A%2F%2Fexample.com 在请求之前,开发者需要先到开发者中心对应应用内,配置授权回调地址。 |
https://openauth-sandbox.dl.alipaydev.com/oauth2/publicAppAuthorize.htm?app_id=2021000122650399&scope=auth_user&redirect_uri=https://www.xxxx.com/default.html,点击进入授权页面。
auth_code。
auth_code 为:7a7da8e608dd41c39eaxxxxxxxxxxxxxxx。auth_code 作为入参传入。{
"code":"7a7da8e608dd41c39ea888940139QD01",
"grantType":"authorization_code"
}{
"alipay_system_oauth_token_response": {
"access_token": "authusrB_D880ea78c7248ed91e292f3cb2dxxxx",
"alipay_user_id": "208872200175xxxx",
"auth_start": "2023-08-29 13:49:59",
"expires_in": 1296000,
"re_expires_in": 2592000,
"refresh_token": "authusrB_d7fb400c8d14333b856eeebf482xxxx",
"user_id": "208872200175xxxx"
}
}auth_token 使用 步骤二 中返回的 access_token。{
"auth_token":"authusrB_D880ea78c7248ed91e292f3cb2xxxx"
}{
"alipay_user_info_share_response": {
"code": "10000",
"msg": "Success",
"age": "44",
"avatar": "https:\/\/tfs.alipayobjects.com\/images\/partner\/https:\/\/mdn.alipayobjects.com\/sandboxsys\/afts\/img\/AibKQZxFsLUAAAAAAAAAAAAADgSLAQBr\/original",
"cert_no": "417238197809170691",
"cert_type": "0",
"city": "资阳市",
"country_code": "CN",
"deliver_addresses": [{
"address_code": "512000",
"default_deliver_address": "F",
"deliver_city": "资阳市",
"deliver_province": "四川省"
}],
"display_name": "ookuoo7552@sandbox.com",
"email": "ookuooxxxx@sandbox.com",
"gender": "m",
"inst_or_corp": "N",
"is_blocked": "F",
"is_certified": "T",
"is_student_certified": "F",
"member_grade": "unknown",
"mobile": "10900000001",
"nick_name": "沙箱账号",
"person_birthday": "19780917",
"person_birthday_without_year": "0917",
"province": "四川省",
"user_id": "208872200175xxxx",
"user_name": "ookuoo7552",
"user_status": "T",
"user_type": "2"
}
}auth_code,所以不需要设置授权回调地址。