【问题标题】:React Template w/Identity Server not Working in .NET 6 - Bearer error The issuer is invalidReact Template w/Identity Server not working in .NET 6 - Bearer error The issuer is invalid
【发布时间】:2021-12-30 15:08:24
【问题描述】:

当我尝试使用 .NET 6 React 模板时,我可以注册用户并登录。但是当我尝试点击“获取数据”页面时,我收到了这个错误:

Bearer error="invalid_token", error_description="The issuer 'https://localhost:44449' is invalid"

有什么建议吗?

【问题讨论】:

    标签: asp.net-core asp.net-identity .net-6.0


    【解决方案1】:

    在开发中运行时个人身份验证的 SPA 模板问题

    第一次运行 SPA 应用时,SPA 代理的权限可能会被错误地缓存,从而导致 JWT 不记名由于无效的颁发者而被拒绝。解决方法是重新启动 SPA 应用程序,问题将得到解决。如果重启不能解决问题,另一种解决方法是在 Program.cs 中为您的应用指定权限: builder.Services.Configure("IdentityServerJwtBearer", o => o.Authority = "https://localhost:44416" );其中 44416 是 spa 代理的端口。

    https://github.com/dotnet/core/blob/main/release-notes/6.0/known-issues.md#aspnet-core

    【讨论】:

      猜你喜欢
      • 2022-01-10
      • 2020-11-11
      • 2021-03-24
      • 2022-12-27
      • 2023-01-27
      • 1970-01-01
      • 2014-11-23
      • 2022-07-12
      • 1970-01-01
      相关资源
      最近更新 更多