Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

shashi_verma's avatar

How to use access token without filling it inside the postman?

I have created an API in Laravel using Passport, everything is working fine, generating the access token and using the token in Postman to show the data. When the user is login, I save the access token in the database Users table The problem is that I have to pass the access token in the header part of postman manually. How I can pass the generated access token automatically to the header, or anywhere, there I need.

0 likes
3 replies
Lars-Janssen's avatar

If you have the new postman you can go to the tab Authorization here you can select Bearer and pass the token.

shashi_verma's avatar

@lars-janssen yes bro I know that, but want to send this info of headers: [ 'authorization': Bearer. $accessToken ] through my code, not through the postman, after googling I got the idea that this may be done by middleware

Please or to participate in this conversation.