Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

AuthenticationContext.AcquireTokenByAuthorizationCode

$
0
0

Hello,

I am having trouble with the AcquireTokenByAuthorizationCode.

If using the method AcquireTokenByAuthorizationCode, I get this error:

'Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext' does not contain a definition for 'AcquireTokenByAuthorizationCode' and no extension method 'AcquireTokenByAuthorizationCode' accepting a first argument of type 'Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext' could be found (are you missing a using directive or an assembly reference?)

If I will use the available method AcquireTokenByAuthorizationCodeAsync, I get this error:

Below are the codes I am using:

             

 var queryString = Request.QueryString;

string authCode = queryString["code"];

 TokenCache tokenCache = new TokenCache();
 AuthenticationContext authContext = new AuthenticationContext(string.Format(AuthorityUri, _configuration.ADTenant), tokenCache);
 ClientCredential clientCredentials = new ClientCredential(_configuration.ClientId, _configuration.ClientSecret);
AuthenticationResult authResult = authContext.AcquireTokenByAuthorizationCode(authCode, new Uri(_configuration.RedirectUri), clientCredentials);

Please Suggest me any Resolution to this.


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>