ADAL.NET v3的不与UserCredential支持AcquireToken? [英] ADAL.NET v3 does not support AcquireToken with UserCredential?

查看:551
本文介绍了ADAL.NET v3的不与UserCredential支持AcquireToken?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在ADAL.NET 2.x中,我们使用以下code。使用获得来自Azure的AD标记 UserCredential 和它完美的作品:

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);

当我今天升级ADAL.NET v3中,code不能了,因为在新版本编译, 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.

我怎么可以ADAL.NET V3的新版本解决这个?

How I can workaround this with the new version of ADAL.NET v3?

推荐答案

使用 UserPasswordCredential 类,而这是UserCredential的子类

Use UserPasswordCredential class instead which is a subclass of UserCredential

这篇关于ADAL.NET v3的不与UserCredential支持AcquireToken?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆