小程序获取与授权码失败,报错41001
发布于 4 年前 作者 fangjie 7690 次浏览 来自 问答

接口:

获取预授权码pre_auth_code

该API用于获取预授权码。预授权码用于公众号或小程序授权时的第三方平台方安全验证。

接口调用请求说明
http请求方式: POST(请使用https协议)
https://api.weixin.qq.com/cgi-bin/component/api_create_preauthcode?component_access_token=xxx

POST数据示例:

{
"component_appid":"appid_value"
}
请求参数说明
参数说明
component_appid第三方平台方appid


代码:

$component_access_token = $this->getComponentAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/component/api_create_preauthcode?component_access_token=" . $component_access_token;
$data = json_encode(array('component_appid' => $this->_component_appid));
$ret = json_decode($this->_curlPost($url, $data), true);
//getComponentAccessToken方法获取access_token

报错:

41001

access_token missing hint: [B9NgFA0627vr30]

请问有遇到这个问题的吗?

已确定获取成功access_token

1 回复

请问是怎么解决的?

回到顶部