Microsoft.IdentityModel.Clients.ActiveDirectory.UserCredential does not take 2 parameters?

后端 未结 1 1310
星月不相逢
星月不相逢 2020-12-16 04:37

I\'m using ADAL in my code. One thing I want to use is to use different credentials, so I can authorize different users against Azure AD in the console program.



        
相关标签:
1条回答
  • 2020-12-16 05:37

    In ADAL .NET v3 UserCredential Constructor is no longer supports the second parameter (password), instead you need to use UserPasswordCredential class

    Example

    var credentials = new UserPasswordCredential(userName, password);
    var context = new AuthenticationContext(authorityUri);
    var authResult = context.AcquireTokenAsync(resource, clientId, credentials).Result;
    
    0 讨论(0)
提交回复
热议问题