1

I am trying to connect to dynamics 365 by using the reference given in the link below

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

After User authentication at the below code, control goes to catch block saying

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

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

I understand that for other Microsoft Apps there is a client App key and client Secret key with which we can acquire access token, But this is an Azure directory App which has only Client App key. Please Correct me if my understanding is wrong.

Hyder Ahmed
  • 149
  • 2
  • 14

1 Answers1

1

What version of ADAL are you using? Looks like you need to be 2.x for it to work. From that documentation page you linked:

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.

I'm looking at my last snippet of test code which uses v2.29 and I don't have an AcquireToken method with those parameters.

GotDibbs
  • 3,068
  • 1
  • 23
  • 29
  • Do we have to create an individual App in an azure directory to access Dynamics 365. Cant, we create One App in Azure directory and access Dynamics 365 of other clients like we do in Microsoft App portal? – Hyder Ahmed Apr 19 '18 at 07:23
  • @HyderAhmed yes, you can. I'd submit a new question for that though. I'm not exactly sure on the details of how that would work and also the answer may depend on the details of your exact situation. – GotDibbs Apr 19 '18 at 17:05