如何在2016年crm上进行身份验证

时间:2017-09-06 01:33:01

标签: c# asp.net-web-api2 microsoft-dynamics adal dynamics-crm-2016

我们正在运行CRM 2016,目前我正在尝试使用msdn提供的code进行身份验证:

    // TODO Substitute your correct CRM root service address, 
string resource = "https://mydomain.crm.dynamics.com";

// TODO Substitute your app registration values that can be obtained after you
// register the app in Active Directory on the Microsoft Azure portal.
string clientId = "e5cf0024-a66a-4f16-85ce-99ba97a24bb2";
string redirectUrl = "http://localhost/SdkSample";


// Authenticate the registered application with Azure Active Directory.
AuthenticationContext authContext = 
    new AuthenticationContext("https://login.windows.net/common", false);
AuthenticationResult result = authContext.AcquireToken(resource, clientId, new
                                                       Uri(redirectUrl));

redirectUrl在以下情境中的确切含义是什么?

string redirectUrl = "http://localhost/SdkSample";

如何识别AuthenticationContext对我们环境的位置,如下所示:

AuthenticationContext authContext = 
new AuthenticationContext("https://login.windows.net/common", false);

0 个答案:

没有答案