0
我试图使用IdentityServer4进行身份验证时不断收到错误。我已经看过这个问题的一些资源,但所有这些都不涉及我的问题。 我正在做一个JSON请求https://localhost:44377/signin-oidc
,但是这是从AspCore认证DLL身份服务器4,message.State为空或为空
Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectMiddleware记录:信息:错误从RemoteAuthentication:OpenIdConnectAuthenticationHandler:message.State为null或空..
我Startup.cs配置是这样的:
services.AddIdentityServer()
.AddInMemoryIdentityResources(Config.GetIdentityResources())
.AddInMemoryApiResources(Config.GetApiResources())
.AddInMemoryClients(Config.GetClients())
.AddTestUsers(Config.GetTestUsers())
.AddTemporarySigningCredential();
app.UseIdentityServer();
app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationScheme = "cookie" });
app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions
{
ClientId = "openIdConnectClient",
Authority = "https://localhost:44377/",
SignInScheme = "cookie",
TokenValidationParameters = new TokenValidationParameters
{
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes("clientpassword"))
},
CallbackPath = "/signin-oidc"
});
而且我试图访问LO客户端OKS这样
new Client
{
ClientId = "openIdConnectClient",
ClientName = "Example Implicit Client Application",
AllowedGrantTypes = GrantTypes.Implicit,
AllowedScopes = new List<string>
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
IdentityServerConstants.StandardScopes.Email,
"role",
"customAPI"
},
ClientSecrets = new List<Secret> {
new Secret("superSecretPassword".Sha256())},
RedirectUris = new List<string> {"https://localhost:44377/signin-oidc"},
PostLogoutRedirectUris = new List<string> {"https://localhost:44377"}
}
他们有一吨的idserver回购的例子。你看过那里吗? –
我已经看过他们我也一直在跟着教程。我只想验证与测试用户一起工作,我不想迁移他们的数据库。 –
你有中间件的顺序是否正确?这是非常具体的,必须是正确的 –