We were recently getting the below error while trying to call Dynamics 365 Web API through Postman.
“401 Unauthorized”
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
References –
Hope it helps..
Thanks for the post, saved me lots of debugging time.
LikeLike
Thank you so much for the hint, it saved us after hours of attempts
LikeLike
im having the correct token but still get 401 when try to get data
LikeLike
thank you, the M$ documentation is so trash. Your blog actually getting to the point.
LikeLike
thank you, totally agree with M$ trash documentation
LikeLike
I love you man after 10 days of search you save my lif
LikeLike
god damned great
LikeLike