Passport and grant_type client_credentials issue
Hi,
I'm having issues getting this to work. I want to fetch data from my Laravel application backend to my Symfony console command application using Passport and thephpleague/oauth2-client. But its not working out for me. I can't even get it to work in a terminal with curl.
It is working when running it through my site. I can access my API endpoints (with passports http kernel web middleware). I've also tried with postman and it works with "Personal access tokens". I've also tried with a consumer web application and that is working as well.
But when I try grant_type client_credentials it doesn't work and this is how I do it from a terminal:
Execute: curl -X POST -d "client_id=3&client_secret=siekuks5vMPRkyhKQbhv48s0io4BBnms782aFngw&grant_type=client_credentials&scope=*" http://local.dev/oauth/token
Response: {"token_type":"Bearer","expires_in":3155673600,"access_token":"eyJ0eX...cJo"}
Execute: curl --header "Authorization: Bearer eyJ0eX...cJo" http://local.dev/api/user
Response:
<title>Redirecting to http://local.dev/login</title>
</head>
<body>
Redirecting to <a href="http://local.dev/login">http://local.dev/login</a>.
</body>
It works with curl If I try with any personal access tokens created.
What am I missing here? Maybe I should use personal access token in my use case?
Please or to participate in this conversation.