Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Identityserver4 方法GetTokenAsync不可用_Identityserver4 - Fatal编程技术网

Identityserver4 方法GetTokenAsync不可用

Identityserver4 方法GetTokenAsync不可用,identityserver4,Identityserver4,我正在关注IdentityServer4中的快速入门。当我实现“切换到混合流并添加API访问返回”教程时,我发现获取访问令牌的方法是: ViewContext.HttpContext.Authentication.GetTokenAsync("access_token") 没有。有人知道我必须用什么方法吗?谢谢。问题是,在我的MVC控制器中,我使用了Microsoft.AspNetCore.Authorization的。此库允许使用[Authorize]属性,但有自己的HttpContext.

我正在关注IdentityServer4中的快速入门。当我实现“切换到混合流并添加API访问返回”教程时,我发现获取访问令牌的方法是:

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

没有。有人知道我必须用什么方法吗?谢谢。

问题是,在我的MVC控制器中,我使用了Microsoft.AspNetCore.Authorization的
。此库允许使用
[Authorize]
属性,但有自己的HttpContext.Authentication命名空间。解决方案是使用Microsoft.AspNetCore.Authentication添加
,现在我可以访问GetTokenAsync方法。

您应该将您的评论作为答案