We were recently getting the below error while trying to call Dynamics 365 Web API through Postman.
It turned out that we were using the incorrect Token.
To generate the correct token,
For OAuth 2.0 token endpoint (v1) Version 1
- We need to specify resource with Dynamics 365 URL.
For OAuth 2.0 token endpoint (v2) Version 2
- We need to specify scope with
Dynamics 365 URL followed by .default instead of a resource.
The correct token results in the successful call to the Web API
Hope it helps..
8 thoughts on “Fixed – 401 Unauthorized error while calling Dynamics 365 Web API”
Thanks for the post, saved me lots of debugging time.
Thank you so much for the hint, it saved us after hours of attempts
im having the correct token but still get 401 when try to get data
thank you, the M$ documentation is so trash. Your blog actually getting to the point.
thank you, totally agree with M$ trash documentation
I love you man after 10 days of search you save my lif
god damned great