C# 将AWS Cognito作为OIDC提供程序添加到IdentityServer4
我一直在尝试将AWS Cognito作为外部提供者添加到我的IdentityServer4实例中C# 将AWS Cognito作为OIDC提供程序添加到IdentityServer4,c#,amazon-cognito,identityserver4,C#,Amazon Cognito,Identityserver4,我一直在尝试将AWS Cognito作为外部提供者添加到我的IdentityServer4实例中 services.AddAuthentication().AddOpenIdConnect(options => { options.Authority = "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_ydUErvZQJ/";
services.AddAuthentication().AddOpenIdConnect(options =>
{
options.Authority = "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_ydUErvZQJ/";
options.ClientId = "2m50t6m94ec7pcnuk4179k15sf";
options.ResponseType = OpenIdConnectResponseType.Token;
options.Scope.Add("email");
options.Scope.Add("profile");
options.Scope.Add("openid");
options.Scope.Add("aws.cognito.signin.user.admin");
});
不幸的是,我收到一个错误消息。状态为空。我确信我在配置中遗漏了一些东西。我查阅了AWS Cognito和IdentityServer4文档,似乎看不出我遗漏了什么
System.Exception: An error was encountered while handling the remote login.
---> System.Exception: OpenIdConnectAuthenticationHandler: message.State is null or empty.
--- End of inner exception stack trace ---
at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.HandleRequestAsync()
at IdentityServer4.Hosting.FederatedSignOut.AuthenticationRequestHandlerWrapper.HandleRequestAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at IdentityServer4.Hosting.BaseUrlMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
嗨,你能成功吗?