Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Answered

Consume Retail Server APIs in external applications - testing in Postman error Microsoft_Dynamics_Commerce_Runtime_InvalidAudience

(0) ShareShare
ReportReport
Posted on by 42

We are setting up integration to D365 Commerce and have followed the instructions / guidelines in https://learn.microsoft.com/en-us/dynamics365/commerce/dev-itpro/consume-retail-server-api.

The environment is of type MS managed acceptance test (generated on ice, West Europe).

Following the guideline, we have in Azure AD set up

  • an application for the Retail Server,
  • an application for the client,
  • added a client secret,
  • registered the app in the finance and operations app,
  • generated the Authorization token in Postman. 

However, when testing the call to the Api from Postman, we run into the error : 

"TypeName": "UserAuthenticationException",
"Exception": "{\r\n \"ErrorResourceId\": \"Microsoft_Dynamics_Commerce_Runtime_InvalidAudience\",\r\n \"LocalizedMessage\": \"The audience validation failed. Contact your system administrator to set up identity providers properly in retail headquarters.\\r\\n- If you are using Personnel ID and Password logon, make sure relying parties are correctly configured.\\r\\n- If you are using Azure AD logon, make sure both relying parties and server resource ids are correctly configured.\"\r\n}",
"CorrelationId": "7cc75ad7-1b84-44ee-8987-bfa4aff6880b"

Any idea on where to look to find a solution ?
Here are the screenshot of our setup.

Azure AD Retail Server App registration

pastedimage1678795745811v3.png
Azure AD Scope
pastedimage1678796246511v6.png
Azure AD client reg
pastedimage1678796402679v7.png
Register app in D365 Commerce (shared parameters)
pastedimage1678796626257v8.png
  • RS-30070451-0 Profile Picture
    on at
    Consume Retail Server APIs in external applications - testing in Postman error Microsoft_Dynamics_Commerce_Runtime_InvalidAudience
    Hi, 
     
    I was facing this issue earlier but after setting up Identity Providers, we are now facing this:
     
    We are looking to consume APIs in Postman for a client (Retail client) using MS Dynamics 365 F&O for a 3rd Party Application and have followed the following documentation:
     
    However, we are facing the following error:
     
    Microsoft_Dynamics_Commerce_Runtime_AuthorizationFailed\",\r\n  \"LocalizedMessage\": \"The user is not authorized to perform this operation
     
    We have tried multiple steps (from a lot of sources) and continue to face this error.
     
    Would you know how to resolve this?
  • Shailee Shah Profile Picture
    84 on at
    Consume Retail Server APIs in external applications - testing in Postman error Microsoft_Dynamics_Commerce_Runtime_InvalidAudience
    Hi All,
     
    I am facing similar issue, even after restart it is not working for me. Any other suggestion ? TIA.
     
  • Verified answer
    Harald Grannes Profile Picture
    42 on at
    RE: Consume Retail Server APIs in external applications - testing in Postman error Microsoft_Dynamics_Commerce_Runtime_InvalidAudience

    Microsoft support solved the issue.

    The problem was that we needed to add/modify an azure ad type Identity Provider as shown below and restart the retail server.



    pastedimage1678976517498v1.png

  • Verified answer
    huijij Profile Picture
    19,811 on at
    RE: Consume Retail Server APIs in external applications - testing in Postman error Microsoft_Dynamics_Commerce_Runtime_InvalidAudience

    Hi Harald,

    You can use the Authorization tab to complete the relevant details for the correct data values which be determined by your API at the server side. Please check your configurations following the blog:

    anithasantosh.wordpress.com/.../

  • Harald Grannes Profile Picture
    42 on at
    RE: Consume Retail Server APIs in external applications - testing in Postman error Microsoft_Dynamics_Commerce_Runtime_InvalidAudience

    Calling the API GetOrderHistory from Postman

    pastedimage1678797118779v1.png

  • Harald Grannes Profile Picture
    42 on at
    RE: Consume Retail Server APIs in external applications - testing in Postman error Microsoft_Dynamics_Commerce_Runtime_InvalidAudience

    Postman call to get authorization token

    pastedimage1678796908770v1.png

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,095 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,866 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans