我是Tinypass api集成的新手。
我尝试使用PHP集成Tinypass API。代码如下:
$curl = curl_init();
// Set some options - we are passing in a useragent too here
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => 'http://sandbox.tinypass.com/r2/access?rid=portfolio_id&user_ref=badashah26',
// CURLOPT_USERAGENT => 'Codular Sample cURL Request',
CURLOPT_HTTPHEADER => array(
'AID: xxxxxxxx', // PUT your AID
'signature: xxxxxxxxxxxxxxxxxx', // PUT your signature
'sandbox: true'
)
));
// Send the request & save response to $resp
$resp = curl_exec($curl);
// Close request to clear up some resources
curl_close($curl);
print_r($resp); exit();
响应获取但错误显示。
"error":{"message":"Access denied: invalid AID or signature","code":401}}
任何人都可以找到解决方案。
由于
答案 0 :(得分:0)
我们的REST API文档已更新,提供了有关如何生成自己的API标头的几个步骤。查看http://developer.tinypass.com/main/restapi上的文档。
最佳, Tinypass支持
答案 1 :(得分:0)
这样的事情......? (另)
$aid = 'YOUR AID';
$action = '/r2/access?rid='.$rid.'&user_ref='.$userref;
$request = 'GET '.$action;
$url = 'http://sandbox.tinypass.com'.$action;
$signature = hash_hmac('sha256',$request,$aid);
$auth = $aid.':'.$signature;
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $url,
CURLOPT_HTTPHEADER => array('Authorization: '.$auth);
));
$resp = curl_exec($curl);
curl_close($curl);
print_r($resp); exit();