Laravel 基本护照 api 身份验证 returns "error":"invalid_client","message":"Client authentication failed"

Laravel Passport basic api auth returns "error":"invalid_client","message":"Client authentication failed"

问题

我一直在尝试使用 Laravel Passport,但我不断收到错误 {"error":"invalid_client","message":"Client authentication failed" }.我已经在这个 Android and Laravel 项目中使用了它,但是当我在数据库中看到正确的数据时,我只能正确地注册用户。然后,当 Android 应用程序尝试获取访问令牌时,它崩溃了,因为服务器 return 之前的错误消息。

我也一直按照这个 YouTube tutorial 完全按照它的解释进行操作,但是我在它发送 "access token request".

的部分遇到了这个错误

邮差数据

oauth_clients table


我试过的

我已尝试使用此 page, this GitHub 和许多其他网页页面修复此问题,但没有任何效果

可能的原因


How to print data to the console? I use error_log() but I can't print variable names and with dd()I get and error saying that the variable couldn't be converted to string.

  1. 你必须传错 client_id 和 client_password
  2. 如果你必须右传client_id和client_password然后检查数据库tableoauth_clientsclient_id和client_password是行插入或不插入,如果不添加,则运行控制台中的此命令

php artisan passport:client

这将注册 client_id 和 client_password 然后检查在这个 table(oauth_clients) 如果没有添加然后手动添加 client_id 和 client_passsword

有没有试过这样的配置:? client_id 和 "client_secret" 而不是 client_password。 您在参数中的数据与您在打印 "oauth_clients table" 上发布的数据相同,对,但我认为您的问题是这个参数 "client_password",我以前从未见过这种方式!