错误:未找到租户授权.如果租户没有有效订阅,则可能会发生这种情况

Ric*_*wal 7 c# dynamics-crm azure adal dynamics-365

我已经编写了以下代码来获取CRM的令牌.

class Program
{
    private const string username = "richa@azuretraining112.onmicrosoft.com";
    private const string password = "Pa$$w0rd";
    private const string serviceURL = "https://azuretraining112.crm8.dynamics.com";
    private const string applicationID = "89a70b76-3a71-481f-8755-a7aa97c59c35";
    private const string redirectURL = "https://localhost1";
    private const string authorityURI = "https://login.microsoftonline.com/1d54ea41-cd25-488f-812c-c078e6114065/oauth2/authorize";
    private static AuthenticationResult authResult = null;


    private static void Main(string[] args)
    {
        var credentials = new UserPasswordCredential(username, password);
        var context = new AuthenticationContext(authorityURI);
        authResult = context.AcquireTokenAsync(serviceURL, applicationID, credentials).Result;
    }
}
Run Code Online (Sandbox Code Playgroud)

但是,在运行代码时,我在尝试使用AcquireTokenAsync获取令牌时收到以下错误.

大段引用

我已使用应用程序ID添加了应用程序用户: 在此输入图像描述

我不知道我错过了什么.请帮忙!

我尝试了租户未授权的解决方案,但没有任何效果.

谢谢!

小智 0

使用端口号“ https://localhost1:5000 ”配置此 url,并在 Azure AD 的回复 URL 中配置相同的“ https://localhost1:5000 ”。

让我知道这个是否奏效