【发布时间】:2018-11-07 05:25:22
【问题描述】:
我正在使用 Amazon Cognito,在阅读了一些文档并创建了一个用户池之后,我遇到了一些问题。我相信 cognito 用户池可以与 OpenId 一起使用,以将用户重定向到托管 UI 以进行用户身份验证(无需联合到另一个提供商)。我尝试使用 DotNetCore 2 中的身份验证选项来执行此操作,因为这是我之前与其他提供商所做的事情。
我有以下几点:
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
})
.AddCookie()
.AddOpenIdConnect(options =>
{
options.ResponseType = "code";
options.MetadataAddress = $"https://cognito-idp.{authOptions.AwsRegion}.amazonaws.com/{authOptions.PoolId}/.well-known/openid-configuration";
options.ClientId = authOptions.ClientId;
options.ClientSecret = authOptions.ClientSecret;
});
但每次我尝试它总是返回
{"code":"BadRequest","message":"The server did not understand the operation that was requested.","type":"client"}
只是想知道是否有人对此有任何经验?我尝试在不同区域创建用户池,只是为了确保它不仅在某些区域受支持,而且始终保持相同。
【问题讨论】:
标签: amazon-web-services asp.net-core-mvc asp.net-core-2.0 amazon-cognito