AWS Cognito用户池和OpenID

6
我正在尝试使用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"}

请问是否有人对此有经验?我尝试在不同的地区创建用户池,以确保它不仅受支持于某些地区,但结果总是相同。

1个回答

8

我曾经遇到同样的问题。根据这篇教程,对我的池和代码进行了配置。关键部分是:

可能也很重要的另一个配置是“应用程序集成>域名”。它允许我们配置登录和注册页面的域名。

在我配置完域名后,一切正常运行。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接