Skip to main content

Notifications

Announcements

No record found.

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

Issue in get a ODATA API for D365 F&O

(0) ShareShare
ReportReport
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 6,493 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,264 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,264 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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,642 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,371 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans