我正在编写以下代码:
$data = array(
"client_id"=>"test_id",
"secret"=>"test_secret",
"public_token"=>"test,fidelity,connected");
// $string = http_build_query($data);
$string = json_encode($data);
// echo $string;
//initialize session
$ch=curl_init("https://sandbox.plaid.com/item/public_token/exchange");
//set options
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
//execute session
$exchangeToken = curl_exec($ch) or die(curl_error($ch));
它给了我一个错误:
{
“display_message”:null,
“error_code”:“INVALID_FIELD”,
“error_message”:“client_id必须是格式正确的非空字符串”,
“error_type”:“INVALID_REQUEST”,
“request_id”:“9o4pA”
}
长期坚持这个问题。