首页 > 解决方案 > ServiceStack IdentityServer4 - IdentityServerAuthFeature

问题描述

我想将 IdentityServer 与我的 ServiceStack API 一起使用,但是,当我以这种方法在 Startup.cs 中添加它时:public override void Configure(Container)

Plugins.Add(new IdentityServerAuthFeature
      {
        AuthProviderType = IdentityServerAuthProviderType.UserAuthProvider,
        AuthRealm = "XXX",             
        ClientId = "YYY",         
        ClientSecret = "ZZZ"
      });

当我用我的类 \ 方法包装[Authenticate]并尝试访问它时,我得到了这个响应:

{ "responseStatus": { "errorCode": "Exception", "message": "没有找到与 IdentityServer 提供者匹配的注册身份验证提供者" } }

我错过了什么吗?

这是此IdentityServerAuthFeature的实际实现

编辑 - 解决方案

经过一些调试后,问题出在HostConfig. 我忘记添加了WebHostUrl,我发现当我稍后查看元数据 ( ?debug=requestinfo) 时,错误是:

ConfigurationException appHost.Config.WebHostUrl 必须设置为使用 Identity Server User Login >plugin,以便服务可以将其完整的http://url:port发送到 >Identity Server User Login

标签: servicestack

解决方案


推荐阅读