Skip to main content
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

editSubscribe (0) ShareShare
ReportReport
Posted on by 40

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
  • 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 40 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,797 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 40 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 40 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

Helpful resources

Quick Links

What Motivates a Super User?

We know many of you visit the Dynamics 365 Community and Power Platform…

Demystifying Copilot with Sundar…

Industry experts answer burning questions directly from our amazing Community…

Enabling Copilot Case and Conversation…

Agents can easily recap an ongoing chat, transcribe a voice conversation…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 282,978 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 222,562 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,138

Product updates

Dynamics 365 release plans