After hearing a lot about laravel passport, i thought of implementing it into my new project where my requirement is to create an API that'll be used in a mobile app.
So my mobile app is a client
, which will further have its users.
I followed the steps mentioned by Taylor and also read about it here. In a nutshell I followed these steps:
- Installed
laravel/passport
. - Created a website user.
- Generated passport keys
php artisan passport:install
- Generated
client_id
andclient_secret
usingphp artisan passport:client
- Added
redirection
andcallback
routes inweb.php
- Authorized the user and got the final access token.
Then I tried calling api/user
( with Header Authorization
containing value Bearer eyJ0eXAiOiJKV1...(token)
I received the data. Pretty simple and neat.
But my app users won't have these details. So I thought of configuring Password Grant Tokens which fits perfectly in my requirement.
Now starts the real headache. I've been trying to set this up for the last 3 days and continuously getting
{"error":"invalid_client","message":"Client authentication failed"}
I've tried almost every guide I followed online: Redirection Issues, Add Atleast One Scope Solution, P100Y Issue etc.
But I'm still getting invalid client
error. Here's what I'm passing through POSTMAN to oauth/token
:
{
"grant_type": "password,"
"client_id": "3,"
"client_secret": "8BUPCSyYEdsgtZFnD6bFG6eg7MKuuKJHLsdW0k6g,"
"username": "test@gmail.com,"
"password": "123456,"
"scope": ""
}
Any help would be appreciated.