第一步:获取 component_access_token
post https://api.weixin.qq.com/cgi-bin/component/api_component_token
{ "component_appid":"xxx",
"component_appsecret":"xxx",
"component_verify_ticket":"xxx"
参考接口文档:https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/ThirdParty/token/component_access_token.html
第二步:获取 pre_auth_code
post https://api.weixin.qq.com/cgi-bin/component/api_create_preauthcode?component_access_token=xxx
## body 如下:
{
"component_appid": "xxx"
}
参考接口文档:https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/ticket-token/getPreAuthCode.html
第三步:获取 auth_code
拼接如下链接,通过<a>标签点击跳转授权,之后微信会回调 redirect_url?auth_code=xxx&expires_in=xxx
https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=1&pre_auth_code=2&redirect_uri=3&auth_type=4
参考接口文档:https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Before_Develop/Authorization_Process_Technical_Description.html
第四步:获取refresh_token
POST https://api.weixin.qq.com/cgi-bin/component/api_query_auth?component_access_token=82_Srjel5bo1_4uGdwhjwfW1cvjNKGrqz3LWasv5X-ash8ERLLJ6dkJK2F8sR7Tb-DCf8E5iZDHtLAsVsjt9ReEI8a7UT9Fs6I9GzIMoz1nI8Vs0HVXbxyyT6TT_TkTTWjAJACCF
# body 如下:
{
"component_appid":"appid_value" ,
"authorization_code": "auth_code_value"
}
参考接口文档:https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/ThirdParty/token/authorization_info.html
第五步:获取 authorizer_access_token
POST https://api.weixin.qq.com/cgi-bin/component/api_query_auth?component_access_token=COMPONENT_ACCESS_TOKEN
# body
{
"component_appid": "appid_value",
"authorizer_appid": "auth_appid_value",
"authorizer_refresh_token": "refresh_token_value"
}
参考接口文档:https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/ThirdParty/token/api_authorizer_token.html
第六步:查看/添加生效的业务域名
查看和添加调用同一个接口,传入不同的 body
POST https://api.weixin.qq.com/wxa/setwebviewdomain?access_token=ACCESS_TOKEN
# 查看已生效的业务域名的 body 写法
{"action": "get"}
# 添加业务域名的 body 写法
{
"action": "add",
"webviewdomain": ["https://aaa.com", "https://pe.bbb.com"]
}
你好,没有,具体请开发者查看下Token生成介绍,https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Before_Develop/creat_token.html。按照接口文档说明获取authorizer_access_token后再代调用接口为配置小程序域名
作为第三方平台,前五步不是所有API都必须且通用的吗?