Search code examples
postmannestjsswaggerbackend

bearer token working on swagger but not working on postman after login on postman


When I hit the login API in postman, It works after I hit the other API with bearer token got after login is showing invalid or expired token but the same API when i hit with the same bearer token in swagger it showing results. this happens almost all the API that required bearer token in postman only.

I want to know why my postman is invalid token to valid token.

API tested on postman after getting access token

same access token used to test API on swagger and it works


Solution

  • Bearer token as an option on postman usually means the token is sent in the Authorization headed with the scheme Bearer <token>. Looking at your swagger screenshot, it looks like you want to send the token as the Bearer header instead, which I don't believe postman has built in/automated support for, so you'll need to set that header yourself