Oyedepo Olufemi

Oyedepo Olufemi

  • 1.7k
  • 229
  • 2.6k

JWT token is always returning a ‘401 Unathorized’

Sep 6 2019 10:16 AM
I'm building a an ASP.NET Core Web API that will consume some data entitie on Dynamics 365 F&O.
I've registered an APP on Azure and generated the neccessary credentials (client_id, client_secret, etc)
When i hit the endpoint directly from postman, this is what i get:
And when i use this access_token to make calls on the oData endpoint, i get a '200 OK' response:
Everything is fine up to this point.....
But ive wrapped the whole access token retrieval into a controller and when it hit the endpoint for this controller, i get access token...Cool!
But when i use the jwt token marked in black to make requests, i get a '401 unathorized' response, but despite checking from jwt.io, the token looks OK.
Someway somehow my token gets invalidated .

Brought to you by:

Answers (10)