ADAL.NET v3 does not support AcquireToken with UserCredential?

[亡魂溺海] 提交于 2019-11-28 09:51:57
Kanishk Panwar

Use UserPasswordCredential class instead which is a subclass of UserCredential

Try UserPasswordCredential, the class had to be renamed in v3.

FYI, it seems as though they have removed this functionality from ADAL. source

To authenticate with a users username/password combo, I believe you will have to use HttpClient and make the post request yourself.

Post to:

https://login.microsoftonline.com/yourdomain.onmicrosoft.com/oauth2/token

with:

resource={resource}&client_id={clientid}&grant_type=password&username={username}&password={password}&scope=openid&client_secret={clientsecret}

in the request

Taylor Maxwell

This fixes the issue for the UserCredentials, but you also seems to be a change to the AuthenticationContext type which no longer seems to have an AcquireToken method. You can address this by using AcquireTokenAsync

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!