Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Method GetTokenAsync unavailable

I´m following the Quickstarts from IdentityServer4. When I implement the "Switching to Hybrid Flow and adding API Access back" tutorial, I found that the method to get the access token in line:

ViewContext.HttpContext.Authentication.GetTokenAsync("access_token")

is not available. Someone knows what method I must to use? Thanks.

like image 973
Juan Carlos Santana Avatar asked Oct 18 '25 14:10

Juan Carlos Santana


1 Answers

The problem was that in my MVC controller I had the using Microsoft.AspNetCore.Authorization;. This library allows use the [Authorize] attribute but has his own HttpContext.Authentication namespace. The solution is add using Microsoft.AspNetCore.Authentication and now I can access to the GetTokenAsync method.

like image 111
Juan Carlos Santana Avatar answered Oct 22 '25 06:10

Juan Carlos Santana