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

Problem

I try to use Laravel Passport, and I get the error {"error": "invalid_client", "message": "Client authentication failed"}. I used it in this Android and Laravel , but I can just register the user correctly as I see the correct data in the database. Then, when the Android application tries to get the access token, it crashes because the server returns the previous error message.

I also followed this YouTube tutorial exactly as it is being explained, but I got this error in the part that it sent the "access token" request. "

Postman Data Postman Data

oauth_clients table Database data


What i tried

I tried to fix this using this Stack Overflow page, this is GitHub and many other web page pages, but nothing worked

Possible reason

  • I think this may be a mismatch between my version of laravel and the passport (see below). I changed the laravel version manually to 5.4, but I got a composer error. I do not want to reinstall laravel because I think I can destroy all my laravel projects.

  • The user_id column should be filled with laravel (I have manually changed it to user_id of the user, after which I restored it to zero) composer.json


How to print data on the console? I am using error_log (), but I cannot print the names of the variables and using dd () I get an error saying that the variable cannot be converted to a string.

0
source share
2 answers

Never tried such configurations :? client_id and "client_secret" instead of client_password. Your data in the parameter is the same that you placed the "oauth_clients table" when printing, but I think your problem is with this parameter "client_password", which I had never seen before this way!

+1
source
  • you need to mistakenly pass client_id and client_password
  • If you need to pass pass client_id and client_password, then check in the database table oauth_clients client_id, and client_password is inserted into the row or not, if not added, then run this command in the console

php artisan passport: client

this will register client_id and client_password, and then check that in this table (oauth_clients), if not added, then the added client_id and client_passsword are added

0
source

Source: https://habr.com/ru/post/1270633/


All Articles