I always got invalid grant type when login .I am using Laravel 7 and passport 8.4.
I can confirm that I create the client_secret without error by running php artisan passport:install but I cant find any possibility why getting the access tokens and refresh tokens does not work.
$credentials = [
'grant_type' => 'password',
'client_id' => '2',
'client_secret' => 'zcdHbITBhD5PPgGZ4n8qpIgYmmK83hcdYTbvLmja',
'username' => $email,
'password' => $password,
'scope' => '*',
];
$request = Request::create('oauth/token', 'POST', $credentials, [], [], [
'HTTP_Accept' => 'application/json',
'Content-type' => 'application/x-www-form-urlencoded'
]);
$response = app()->handle($request);
//$response = app('router')->prepareResponse($request, app()->handle($request));
$decodedResponse = json_decode($response->getContent(), true);
// if ($response->getStatusCode() != 200) {
I am using custom user provider that correctly set in config, and I notice if I change the grant_type to 'client_credentials' it will just work, but without the refresh token which what I want.
Any ideas ?