web
You’re offline. This is a read only version of the page.
close
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

Connection from postman to D365 fails - 401 unauthorized error

(1) ShareShare
ReportReport
Posted on by 41
Team,
I am trying to call a D365 FO WEB API from Postman and getting '401 unauthorized' error.
 
Steps 1: 
Note: I have used Bearer token option, API permissions are granted on App registeration, I am trying to connect Tier 1 development server
URL used to retrieve token: https://login.microsoftonline.com/TenantId/oauth2/token
Body of request:
client_id        - Azure App client id
grant_type    - client_credentials
resource       - D365 URL (Without slash at end)
client_secret - App secret
After sending the above HTTP request, I received a token
 
Step 2:
 
//////
 
Also on the environment event viewer, this was the exact error message.
 
/'Can read the token but failed validating token with exception 'The token issuer https://sts.windows.net/tenantid/ is not valid, only the following issuers are allowed: (Listed some other tenants where my app and server not hosted)//
 
Please let me know what I am missing
I have the same question (0)
  • Layan Jwei Profile Picture
    8,118 Super User 2025 Season 2 on at
    Hi Monikasree,

    How did you define the tenantId when you got the token?
    the URL should contain /:tenant_id/ and then define it's value in Params
    ​​​​​​​
    it should be sth like this:



    let me know if it works with you.
    ​​​​​​​
    Thanks,
    Layan Jweihan
  • Monikasree GM Profile Picture
    41 on at
    Hello Layan Jwei ,
     
    For security reasons I have not mentioned the exact tenantid in the previous image. 
     
    I have used the URL with Azure App tenant id and defined the same in the body as well.
     
  • Suggested answer
    Layan Jwei Profile Picture
    8,118 Super User 2025 Season 2 on at
    Hi Monikasree,

    As I mentioned in the previous reply, the tenant_id shouldn't be defined in the body. You should define it's value in Params

    Did it work with you at the end?

    Thanks,
    Layan Jweihan

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 451 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 428 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans