Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Multi-tenant server-to-server authentication - User consent issue

Posted on by

I have followed this walkthrough to create a multi-tenant web application that can connect to Dynamics 365 CE Online. Walkthrough: Multi-tenant server-to-server authentication.

When I ran the app for the first time and tried to sign in to the Dynamics CRM, it asked me to provide a consent that I accepted. And then it returned the below error:

Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException HResult=0x80131500 Message=AADSTS65001: The user or administrator has not consented to use the application with ID 'XXX' named 'MvcCrmStsWalkthrough'. Send an interactive authorization request for this user and resource.   

For subsequent tries, it didn't ask for consent. However, kept returning the aforementioned error.

What I have used for this POC

  • Dynamics CRM Online trial
  • Azure Active Directory service that was included by default with the CRM trial and was enough to perform application registration on Azure AD
  • Visual Studio 2017 community edition (The only difference from what is mentioned in the walkthrough was VS2015)

What I have tried so far

  • In Azure AD I already have granted permission using the 'Grant Permission' button on the registered app Settings > Required Permissions (Seems accepting user consent through my custom app does the same)
  • Setting oauth2AllowImplicitFlow to true in the Azure AD app manifest
  • I verified that the O365 account that I am using to log in through the app has Global Administrator directory role in the AD

Sample code

Exactly the same as mentioned in the walkthrough.

Please help.

*This post is locked for comments

  • Suggested answer
    Nishant Rana Profile Picture
    Nishant Rana 55 Microsoft Employee on at
    RE: Multi-tenant server-to-server authentication - User consent issue

    This might help

    nishantrana.me/.../

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans