I am new to Laravel, just started building REST APIs. I have started from creating login and registration APIs. For user authentication, I have used PASSPORT of Laravel. I have performed a number of steps defined at https://laravel.com/docs/5.4/passport#installation. Everything is going well expect core functionality. I have migrated tables, I am able to see routes list by $ php artisan route:list
. But I am facing issue at where I am trying to generate a token with the help of oauth/token
.
This is the POST data what I am sending to
127.0.0.1:8000/oauth/token
{
"client_id": 2, //from oauth_clients table
"client_secret": "XcYUuFDOtWByLPOdrQbW5rEf9tWBqoToPgJVAA3L", //from oauth_clients table
"grant_type": "password",
"username": "adnmin@test.com", //saved in users table
"password": "$2y$10$4fJz1/DA2mFg.McFfCqrkuXm1/wojQQh3eM4EEkbLjclGb4nETRy2", //saved in users table
"scope": "*"
}
I am continually getting invalid_credinatials. I am not able to understand what is the parameter to be sent to the place of username and password.
The password saved in the database is in the encrypted form, so you have to give the actual password there, as Laravel automatically encrypts your password.