我已经编码了很多年,所以请原谅我。我正在尝试使用以下代码从估算API 获得令牌,但是返回此错误:
" SSL证书问题:无法获得本地发行人证书"
<?php
$code= $_GET['code'];
$url = 'https://identity.reckon.com/connect/token';
$auth_creds = "CLIENTID:CLIENTSECRET";
$headers = array(
"Content-Type: application/x-www-form-urlencoded",
"Authorization: Basic" . base64_encode($auth_creds));
$body = 'grant_type=authorization_code&code=' . $code .
'&redirect_uri=http://localhost';
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
$response = curl_exec($ch);
if($response === false)$response= curl_error($ch);
curl_close($ch);
echo $response;
?>
我正在关注Reckon API OAUTH帮助文档:https://reckon.helpdocsonline.com/reckon-api-authorisation-ervices
我设法解决了。我必须添加此代码: curl_setopt($ ch,curlopt_ssl_verifypeer,false(;但是,我然后遇到另一个错误" {"错误":" Invalid_client"}" ...这是由于错误地编码我的客户ID和客户秘密。但是现在这是固定的,我有我的令牌和刷新令牌。