The following parameters are returning the specified error:
grant_type: password
client_id: 2
client_secret: Dy1hUVkIPM9hWb2dMGrtf6GxpkSzRX6PwGZICYN6
username: [email protected]
password: secret
scope: *
Response:
{
"error": "unsupported_grant_type",
"error_description": "The authorization grant type is not supported by the authorization server.",
"hint": "Check that all required parameters have been provided",
"message": "The authorization grant type is not supported by the authorization server."
}
I'm using artisan serve on my localhost as the server. I'm just trying to get passport working and I'm following the following youtube video.
This appears to be some sort of incompatibility with laravel passport and laravel 5.8. Not sure why its doing it. But I've now tried installing multiple versions of passport and it still doesn't work.
Strange that it says authorization grant type in the error message. Are you sure you are issuing a password grant request?
Hi there,
Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels:
However, this issue will not be locked and everyone is still free to discuss solutions to your problem!
Thanks.
@pneves001 did you ever solve this problem? I'm experiencing the same.
I think I did fix it. I can't remember how though. It's been several months.
Oh I think it was an issue with my routes file.
Your route needs to be preceded by the following:
Route::middleware('auth:api')->post('/your-route', 'yourcontroller@yourfunciton');
This is the functions you wish to secure with authentication.
The login function doesn't contain this. I think you need to assign a name to your routes as well.
I recall there being something with the header in your request as well. You have to set it to like Bear Token and then add the token. You can do that in postman to test it.
I am facing this exact same issue.

Did anyone find a solution?
Unfortunately, there is no support that really provides a solution to this problem. The solution for my case is to install the latest version of Laravel with the passport version 7.5.1. With this version, it works correctly and this error does not occur.
It is not a problem of bad use of the tool is a bug present in some specific conditions.
{
"error": "unsupported_grant_type",
"error_description": "The authorization grant type is not supported by the authorization server.",
"hint": "Check that all required parameters have been provided",
"message": "The authorization grant type is not supported by the authorization server."
}

I'm problem with unsupport_grad_type . did anyone find?
laravel V6 last version
i had same problem, be sure you are sending in request header content-type: application/x-www-form-urlencoded
working code
$data = [
'username' => '[email protected]',
'password' => 'password',
'client_id' => '2',
'client_secret' => 'qvH2Ij0vMCx7w4SAW0sB1oUCrYBnNyz8AzNNfeKC',
'grant_type' => 'password',
];
$request = app('request')->create('/oauth/token', 'POST', $data);
$response = app('router')->prepareResponse($request, app()->handle($request));
I'm having the same problem. The only working solution was to downgrade to 7.5.1 version.
@mohavee It's working. Thanks
Thanks @mohavee.
$data = [
'username' => '[email protected]',
'password' => 'password',
'client_id' => '2',
'client_secret' => 'qvH2Ij0vMCx7w4SAW0sB1oUCrYBnNyz8AzNNfeKC',
'grant_type' => 'password',
];
$request = app('request')->create('/oauth/token', 'POST', $data);
$response = app('router')->prepareResponse($request, app()->handle($request));
@mohavee thanks It's working for me
@mohavee thanks! That saved huge amount of time for me.
Careful if you're testing in Postman that you're setting the variables in the BODY tab and not the PARAMS tab
In my case i had to register the provider in config/app.php file and then it returned the access token
i share solution for resolve this problem.
first u need instal auth
laravel 5 down use make:auth
laravel 5 above use
~ composer require laravel/ui
~ php artisan ui vue --auth
~ npm install
~ npm run dev
and more important create user using it dont create manualy on db
hope this helpfull
npm run dev
It's not necessary, but when u add directly on db remember that the password need to be encripted
Most helpful comment
i had same problem, be sure you are sending in request header
content-type: application/x-www-form-urlencodedworking code