In ADAL.NET 2.x, we use the below code to acquire token from Azure AD using UserCredential
and it works perfectly:
var authContext = new AuthenticationContext(Authority);
var userCredential = new UserCredential(username, password);
var token = authContext.AcquireToken(ResourceUrl, ClientId, userCredential);
When I upgraded ADAL.NET v3 today, the code cannot be compiled anymore because on the new version, UserCredential
does not have overloaded constructor with username and password.
How I can workaround this with the new version of ADAL.NET v3?
Use UserPasswordCredential
class instead which is a subclass of UserCredential