I am developing a REST API using Laravel. I am implementing authentication feature to my API using Passport. I am following this tutorial- https://scotch.io/@neo/getting-started-with-laravel-passport. I installed and configured successfully. The only issue I am having now is that when I request token from this endpoint "oauth/token", the API is always asking for username and password. Please, see my scenario below.
I registered a user in the database like this.
$user = [
'name' => 'waiyanhein',
'email' => 'iljimae.ic@gmail.com',
'password' => bcrypt('testing')
];
App\User::create($user);
The user is registered and a record is created in the database. Using the client id and secret which I got during the installation of password and user credentials, I made a request to generate the access token as in the tutorial. But I made the request from the REST Client. My request is as in the screenshot below.
As you can see, I provided the valid user credentials and client id and secret. When I made the request, the REST client tool prompt a pop up box requesting for the user credentials again as in the screenshot below.
When I enter the credentials again, it keeps popping up the dialog box even if the credentials are valid. Instead of using username, I tried using email as well. Not matter how I tried, it is just asking for the user credentials. Why and what is wrong with the request? How can I correctly pass the credentials in the request?
bcrypt('testing')
. – Brian Leename
. e.g.protected $primaryKey = "name";
I hope this could help you. – Miron