gpt4 book ai didi

identityserver4 - 方法 GetTokenAsync 不可用

转载 作者:行者123 更新时间:2023-12-05 01:19:03 26 4
gpt4 key购买 nike

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

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

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

最佳答案

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

关于identityserver4 - 方法 GetTokenAsync 不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42394132/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com