我想使用curl和grant_type使用登录名和密码进行身份验证
<?php
$clientID= 'ddd@ddd.fr';
$clientSecret='1234';
$data =
'client_id=' . $clientID . '&' .
'client_secret=' . $clientSecret . '&' .
"grant_type=client_credentials";
$url = "https://xxxxxx.fr:4568/connect/token";
$headers = array(
'Accept' => 'application/json',
'Accept-Language' => 'en_US',
"grant_type=client_credentials"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_USERPWD, $clientID . ':' . $clientSecret);
$x = json_decode(curl_exec($ch));
var_dump($x);
?>
当我启动此脚本时,它向我显示此错误:
object(stdClass)[1] 公共'错误'=>字符串'invalid_request'(长度= 15) '公共'error_description'=>字符串'不能指定多个客户端凭据。 (长度= 48)
如果有人知道我该如何解决这个问题。 预先感谢