Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AuthenticationContext does not contain the definition AcquireToken?

Tags:

c#

api

azure

Im trying to play with the Microsoft Power BI REST API but didn't get much far since im not very experienced with the API's

as i understand the Authentication Context is part of the Identity model active directory, which i triple check if it was referenced to the project (the rest of the methods run property)

but there are no methods called AcquireToken or AcquireTokenSilent, i just have other ones called AcquireTokenAsync ans AcquireTokenAsyncSilent idk if they are the some or not.

if someone can provide any light on the matter it will be much appreciated.

Thanks

enter image description here

like image 899
RicardoZepeda Avatar asked Jun 17 '17 01:06

RicardoZepeda


2 Answers

You could be using V3 of ADAL.NET which appears to no longer have AcquireToken(). But it still has AcquireTokenAsync(). Note however that the parameters have slightly changed in the methods for v2 and v3.

ADAL.NET v3 has this AuthenticationContext

ADAL.NET v2 has this AuthenticationContext

like image 158
Frank Fajardo Avatar answered Nov 12 '22 08:11

Frank Fajardo


I had the same issue. When you are using Microsoft.IdentityModel.Clients.ActiveDirectory you need to install the correct version. I tried with the latest version but did not work. But after installing Microsoft.IdentityModel.Clients.ActiveDirectory version 2.22.302111727 error was solved.

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

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

like image 44
Chamila Maddumage Avatar answered Nov 12 '22 10:11

Chamila Maddumage