dreamact3026 2017-10-11 22:38
浏览 71
已采纳

如何在Laravel Passport客户端上设置密码?

I'm trying to set up laravel as an API. I've gone through their documentation on passport and have set up a client with the command php artisan passport:client --password. I gave the client a name and it gave me the id and the secret. But the documentation also asks for the password and none has been set. I tried to connect to it using curl, but all I get back is {"error":"invalid_client","message":"Client authentication failed"}. Where do I set the password for a laravel passport client?

$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));
  • 写回答

1条回答 默认 最新

  • dtng5978 2017-10-12 01:50
    关注

    From the look of it you are using password grant as your auth grant type. For this grant type the username and password is your user's username and password. Password grant uses user login info to generate a unique token for a paticular user.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog