Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

Issue in get a ODATA API for D365 F&O

Posted on by 72

Hello,

I have followed the instructions to get the access token using oAuth flow and I have an app in AAD.

I am able to get the access token but when I try to hit the OData APIs with that token, it gives me 401 Unauthorized. 

Let me know if there a problem in my scope or it's something else?

  • Suggested answer
    Waed Ayyad Profile Picture
    Waed Ayyad 5,955 Super User 2024 Season 2 on at
    Issue in get a ODATA API for D365 F&O
     
     Did you add permission of read/ write for you App registration?
    You can follow this link in order to add permission to your APP registration:
     
    Regards,
    Waed Ayyad
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
     
  • Community member Profile Picture
    Community member 72 on at
    Issue in get a ODATA API for D365 F&O
    Hello,
     
    I just set get URL and Token.
     
     
  • Layan Jwei Profile Picture
    Layan Jwei 7,204 Super User 2024 Season 2 on at
    Issue in get a ODATA API for D365 F&O
    Hi Ruchita,

    can you then show us what you filled exactly in postman when you called the URL?
    show us the link, body and where u put the token

    Thanks,
    Layan Jweihan
  • Community member Profile Picture
    Community member 72 on at
    Issue in get a ODATA API for D365 F&O
    Hi @Layan Jwei,
     
     
    and I am able to get AccessToken & RefereshToken but when I use to get [BaseURL]/data then it's not working, and I am getting 401 Unauthorized.
     
     
    but when I clicked on verified it's just loading a page a lot and not saved so I will try after some time.
  • Suggested answer
    Layan Jwei Profile Picture
    Layan Jwei 7,204 Super User 2024 Season 2 on at
    Issue in get a ODATA API for D365 F&O
    Hi Ruchita,
     
    What is common? you need to replace common with the tenantId which you can take from Azure portal
    "https://login.microsoftonline.com/{{tenantId}}/oauth2/token

    and here's what you should fill the body with

    grant_type: client_credentials
    client_id: your client id
    client_secret: your client secret
    resource: your environment url
     
    Also I think you confirmed that your other question is answered, so please verify the answers to help others
    https://community.dynamics.com/forums/thread/details/?threadid=d82b27d1-f88c-ee11-8179-000d3a570dcd
    ​​​​​​​

    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,900 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,275 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans