连接客户端的 identityServer 3 消息错误:"Unknown client or not enabled"
identityServer 3 message error connecting client: "Unknown client or not enabled"
当我尝试将客户端与 IdentityServer 连接时,服务器日志显示下一条消息:
- [错误]"Unknown client or not enabled: cliente1"*
这是我的 OpenIdConnectAuthenticationOptions:
public void Configuration(IAppBuilder app)
{
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "Cookies"
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
ClientId = "cliente1",
Authority = "https://localhost:44333/core",
RedirectUri = "http://localhost:57598/",
ResponseType = "id_token",
Scope = "openid email",
UseTokenLifetime = false,
SignInAsAuthenticationType = "Cookies",
});
}
这是我的 identityServer 客户端配置:
new Client{
ClientName = "cliente1",
Enabled = true,
ClientId = "cliente1",
ClientSecrets = new List<Secret>
{
new Secret("secret".Sha256())
},
Flow = Flows.Implicit,
//RequireConsent = true,
//AllowRememberConsent = true,
RedirectUris = new List<string> {
"http://localhost:57598/"
},
PostLogoutRedirectUris = new List<string>{
"http://localhost:57598/"
},
AllowedScopes = new List<string>
{
Constants.StandardScopes.OpenId,
Constants.StandardScopes.Email,
//Constants.StandardScopes.OfflineAccess,
//"read",
//"write",
"webapi"
},
AccessTokenType = AccessTokenType.Reference,
IdentityTokenLifetime = 360,
AccessTokenLifetime = 360
},
可能是什么问题?提前致谢
您在 ASP.NET MVC 应用程序中使用 MS 的 OpenID Connect 中间件,该中间件与混合流程一起使用,但客户端的流程设置为隐式。将流设置为混合 (Flow = Flows.Hybrid),它应该可以工作。
当我尝试将客户端与 IdentityServer 连接时,服务器日志显示下一条消息:
- [错误]"Unknown client or not enabled: cliente1"*
这是我的 OpenIdConnectAuthenticationOptions:
public void Configuration(IAppBuilder app)
{
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "Cookies"
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
ClientId = "cliente1",
Authority = "https://localhost:44333/core",
RedirectUri = "http://localhost:57598/",
ResponseType = "id_token",
Scope = "openid email",
UseTokenLifetime = false,
SignInAsAuthenticationType = "Cookies",
});
}
这是我的 identityServer 客户端配置:
new Client{
ClientName = "cliente1",
Enabled = true,
ClientId = "cliente1",
ClientSecrets = new List<Secret>
{
new Secret("secret".Sha256())
},
Flow = Flows.Implicit,
//RequireConsent = true,
//AllowRememberConsent = true,
RedirectUris = new List<string> {
"http://localhost:57598/"
},
PostLogoutRedirectUris = new List<string>{
"http://localhost:57598/"
},
AllowedScopes = new List<string>
{
Constants.StandardScopes.OpenId,
Constants.StandardScopes.Email,
//Constants.StandardScopes.OfflineAccess,
//"read",
//"write",
"webapi"
},
AccessTokenType = AccessTokenType.Reference,
IdentityTokenLifetime = 360,
AccessTokenLifetime = 360
},
可能是什么问题?提前致谢
您在 ASP.NET MVC 应用程序中使用 MS 的 OpenID Connect 中间件,该中间件与混合流程一起使用,但客户端的流程设置为隐式。将流设置为混合 (Flow = Flows.Hybrid),它应该可以工作。