Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / Issue in get a ODATA A...
Finance forum
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?

Categories:
  • Suggested answer
    Waed Ayyad Profile Picture
    Waed Ayyad 3,904 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 4,815 Super User 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 4,815 Super User 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

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,584 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,864 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans