Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/306.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将AWS Cognito作为OIDC提供程序添加到IdentityServer4_C#_Amazon Cognito_Identityserver4 - Fatal编程技术网

C# 将AWS Cognito作为OIDC提供程序添加到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/";

我一直在尝试将AWS Cognito作为外部提供者添加到我的IdentityServer4实例中

           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)

嗨,你能成功吗?