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

How do I set the password on a Laravel Passport client?

我正在尝试将 laravel 设置为 API。我已经在护照上查看了他们的 documentation 并使用命令设置了一个客户端 php artisan passport:client --password。我给了客户一个名字,它给了我 id 和秘密。但是文档还要求输入密码并且 none 已设置。我尝试使用 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));

从外观上看,您正在使用密码授予作为您的身份验证授予类型。对于此授权类型,用户名和密码是您用户的用户名和密码。密码授予使用用户登录信息为特定用户生成唯一令牌。