I was creating a console application to connect to Dynamics 365 Web API, and downloaded “Microsoft.CrmSdk.WebApi.Samples.HelperCode” NuGet package.

I got “AcquireToken method is no longer available” compilation error, when I build the project

Reason & Fix:
- We have to use UserPasswordCredential class in ADAL v3.
- Below is the code snippet
var credentials = new UserPasswordCredential(userName, password);
var context = new AuthenticationContext(authorityUri);
authResult = context.AcquireTokenAsync(serviceUrl, applicationId, credentials).Result;
Refer my previous article for step by step to connect to Dynamics 365 Web API.
🙂

![[Step by Step] Beginner : Create a PCF control and add it to a custom page](https://rajeevpentyala.com/wp-content/uploads/2024/12/image-49.png)

Leave a comment