AuthenticationContext does not contain AcquireToken definition?

I'm trying to play around with the Microsoft Power REST API, but not very far from the fact that I'm not very good at API

since I understand that the Authentication Context is part of the active directory of the Identity model I triple check if it was a project reference (rest of the method launch properties)

but there are no methods called AcquireToken or AcquireTokenSilent, I have others called AcquireTokenAsync and AcquireTokenAsyncSilent idk if they are some or not.

if anyone can provide any light on the matter it would be greatly appreciated.

thank

enter image description here

+3


source to share


3 answers


You can use V3 from ADAL.NET which no longer has AcquireToken (). But it still has AcquireTokenAsync (). Note, however, that the parameters have changed slightly in the methods for v2 and v3.

ADAL.NET v3 has this AuthenticationContext



ADAL.NET v2 has this AuthenticationContext

+4


source


If you are using wrappers, make sure you have the correct version - Microsoft.IdentityModel.Clients.ActiveDirectory -Version 2.21.301221612. After the link, you can run it below. For alternatives, see this blog: https://samtran.me/2018/11/11/power-bi-rest-api/



0


source


I had the same problem. When using Microsoft.IdentityModel.Clients.ActiveDirectory, you need to set the correct version. I tried with the latest version but didn't work. But after installing Microsoft.IdentityModel.Clients.ActiveDirectory version 2.22.302111727, the error was resolved.

If you are using the latest version, the AcquireToken was removed in v3 of the Microsoft.IdentityModel.Clients.ActiveDirectory library. You should now be using AcquireTokenAsync.

Link - https://github.com/AzureAD/azure-activedirectory-library-for-dotnet/issues/443

0


source







All Articles