0

IdentityServer4を使用して認証しようとしてエラーが発生し続けます。私はこの問題のためのいくつかのリソースを見てきましたが、それらのすべては私の問題に関連していません。 私はhttps://localhost:44377/signin-oidcにJSON要求を作ってるんだが、これはAspCore認証DLLIdentity Server 4、message.Stateがnullまたは空です。

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にしようとしているクライアント私はあなたがapp.UseOpenIdConnectAuthenticationAuthenticationScheme = "oidc"を配置する必要があります信じて、この

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"} 
} 
+0

idserverレポには1トンの例があります。そこを見ましたか? –

+0

私はそれらを見てきましたが、私はチュートリアルと共に続けてきました。私はちょうどテストユーザーとの認証をしたい、私は自分のデータベースを移行したくない。 –

+0

ミドルウェアの注文が正しいですか?これは非常に具体的であり、正しいものでなければなりません –

答えて

0

ようOKS。

app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions 
{ 
    AuthenticationScheme = "oidc" 
    ClientId = "openIdConnectClient", 
    Authority = "https://localhost:44377/", 
    SignInScheme = "cookie", 
    TokenValidationParameters = new TokenValidationParameters 
    { 
     IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes("clientpassword")) 
    }, 
    CallbackPath = "/signin-oidc" 
}); 
関連する問題