【发布时间】:2018-03-23 17:48:29
【问题描述】:
我正在尝试将 laravel 设置为 API。我在护照上浏览了他们的documentation 并使用命令设置了一个客户端
php artisan passport:client --password。我给了客户一个名字,它给了我 id 和秘密。但是文档还要求输入密码,但没有设置密码。我尝试使用 curl 连接到它,但我得到的只是{"error":"invalid_client","message":"Client authentication failed"}。 laravel 护照客户端的密码在哪里设置?
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:8000/oauth/token");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array ("X-Requested-With: XMLHttpRequest"));
$postData = array(
'client_id' => '2',
'client_secret' => 'RSR6H3nRaVH0HQIfdC27eY98y1dhbi09UyFm5ckR',
'grant_type' => 'password',
'username' => 'Test',
'password' => '????',
'scope' => '*'
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
print_r( curl_exec ($ch));
【问题讨论】:
标签: php laravel curl laravel-passport