Skip to main content

Notifications

Dynamics 365 Community / Forums / Commerce forum / Consume Retail Server ...
Commerce forum
Answered

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

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
    RS-30070451-0 8 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
    Shailee Shah 80 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
    Harald Grannes 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
    huijij 19,803 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
    Harald Grannes 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
    Harald Grannes 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

Dynamics 365 Community Update – Sep 16th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

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

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,435 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,317 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans