Error 401 Unauthorized when sending request with valid token to Laravel API 5.8 (latest)

Hi!
I’m working on API development but for the last few days I can’t work correctly with API through Postman. I’m emulating mobile app by sending first request to /oauth/token route and then using received Bearer token for further requests. Tried to add this token on Auth tab or set header directly - nothing works. So it looks like token is valid and should be accepted by API, but it does not. Tested same workflow from mobile app - API work in this case and accept Bearer token as it should be.

Can you please help me with some suggestions about how I can solve it? Maybe there were some changes in Postman for the last weeks or months and I need to set header in a different way or something else?

Few minutes ago it started working again without any actions from my side. Most likely, it did not sent auth header in a correct way, so it was not received by API

Hi there,

Welcome to Postman Discourse community!

I can see that you sent a request to an endpoint to get your bearer token which worked fine, but when you tried to use the bearer token for further requests, it doesn’t work.

Can you please select the “Bearer Token” authorization tab and add the token in the token field. Under “Headers”, please select “Content-type” as Key and “application/json” as the corresponding value before making the request.

Please let me know if this works fine.

Hi! thank you for the response. Unfortunately, I can’t reproduce it, as it is working again, but Last few days I was doing it exactly as you wrote: beater token was set on auth tab, content type set to application/json. And it did not work.

Actually, earlier (when I got error) and now (when it works) I use same saved request from collection that was working during last 6 months.

Hi there,

I’m glad you were following the right steps and it seems to be an issue with the API.

It was not an issue with an API) Please read my initial comment. I did not made any changes to it. Same error was while sending request to staging server, production and local copy of the API. Code wasn’t changed, especially on production.

Thanks for clarifying. I wish I could reproduce the issue but I’m glad everything works fine now.

Me too) Thank you for quick response :slight_smile: