使用 OAuth 连接到 Dynamics 365 Customer Engagement Web 服务

Connect to Dynamics 365 Customer Engagement web services using OAuth

我正在尝试使用下面 link 中给出的参考连接到 dynamics 365

https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/connect-customer-engagement-web-services-using-oauth

在以下代码中进行用户身份验证后,控制将转到 catch 块 说

"The request body must contain the following parameter: 'client_secret or client_assertion'"

AuthenticationResult result = authContext.AcquireToken(resource, clientId, new Uri(redirectUrl));

我知道对于其他 Microsoft 应用程序,有一个客户端应用程序密钥和客户端密钥,我们可以使用它们获取访问令牌,但这是一个只有客户端应用程序密钥的 Azure 目录应用程序。理解有误请指正

您使用的是哪个版本的 ADAL?看来您需要达到 2.x 才能正常工作。从您链接的文档页面:

You must use the ADAL 2.0 libraries. All Dynamics 365 Customer Engagement tools, assemblies, and utilities require the patterns supported by ADAL 2.0. The ADAL 3.0 libraries require a sign-in screen to capture user account information and do not provide for passing this account information in a headless fashion as required by Dynamics 365 Customer Engagement.

我正在查看使用 v2.29 的最后一段测试代码,但我没有带有这些参数的 AcquireToken 方法。