小编Nia*_*ray的帖子

AWS Cognito用户池和OpenId

我正在玩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;
});
Run Code Online (Sandbox Code Playgroud)

但每次我尝试它总是返回

{"code":"BadRequest","message":"The server did not understand the operation that was requested.","type":"client"}
Run Code Online (Sandbox Code Playgroud)

只是想知道是否有人有这方面的经验吗?我试图在不同的区域创建用户池,以确保它不仅在某些区域得到支持,而且总是得到相同的.

amazon-web-services asp.net-core-mvc amazon-cognito asp.net-core-2.0

5
推荐指数
1
解决办法
1607
查看次数