Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
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 7,551 Super User 2025 Season 1 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,711 Super User 2025 Season 1 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,711 Super User 2025 Season 1 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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,492 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans