Announcements
Hi,
I am trying to use the d365 F&O APIs to pull the Data entities data. I have followed the instructions to get the access token using oauth flow. I have an app in azure directory. I am able to get the access token. But when I try to hit the odata APIs with that token, it gives me 401 Unauthorised. I don't know what I have been doing wrong. I followed the instructions but could not get APIs working. Any help would be appreciated.
Let me know if you guys need any other information.
Thanks
Moved to D365 Finance forum.
I recommend you to check out the Integration Sample app from Microsoft. It has an OData console app sample as well.
It's a fully functional solution which you can debug and also use as a documentation.
And you can use it to determine if your problem is in your AAD app registration or in your code (or both).
I suggest that you don't implement it by yourself at all - use the authentication utility provided by Microsoft as a part of sample integration applications on GitHub.
i have gone through every possible documentation present there, nothing worked. I am not sure why i am getting 00000002-0000-0000-c000-000000000000 in aud. They dont talk about this in the doc you mentioned. How do i inspect what is causing these values in jwt. I followed this to get the token , docs.microsoft.com/.../v1-protocols-oauth-code
Can you let me know if this is way to get the token to access OData APIs. Or i am using wrong doc to get the token.
I have done everything you mentioned. However when i tries to debug my jwt token, in the "aud" part, i got this {"aud": "00000002-0000-0000-c000-000000000000", ...} which does not seem to be correct, any idea why? also i dont have "upn" in my jwt token info. Maybe the access token is not valid, but not sure why.
First of all try to connect via postman docs.microsoft.com/.../third-party-service-test to confirm that settings are correct. IF you cannot, check that you added application id to FnO and mapped to a user, also check that url is correct, somethims you may have trailing slash in the url.
André Arnaud de Cal...
294,118
Super User 2025 Season 1
Martin Dráb
232,866
Most Valuable Professional
nmaenpaa
101,158
Moderator