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 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀