How are you doing the bearer token? I would do something like"
Accept application/json
Authorization Bearer klhkljnrvevaevjievjqpjvqvjpjvqp48975834753nkc;aswhateverelse
send those as headers with the request in Postman.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am having difficulty understanding the workings of Laravel Passport.
I have set it up as per docs, and I have a route like this in api.php
Route::get('/sales', 'SalesController@index')->middleware('auth:api'); Using all the instructions in the docs I have all the auth middleware etc setup, and when I login to the site in browser, it all works great.
However, whats confusing is that via Postman, in order to test the API, I am getting the unauthenticated error. As per docs Laravel does some magic and makes it work, however in Postman, I am sending the Bearer token after getting it via the route POST:/oauth/token, passing that to my above route, and still getting the unauthenticated error.
So what should the guard on the API route be ? As above, using auth:api, it seems to work well to make sure user is logged in, however how can I test it in Postman ?
Please or to participate in this conversation.