简体   繁体   English

AWS Cognito用户池和OpenId

[英]AWS Cognito User Pools and OpenId

I am playing around with Amazon Cognito and after reading some of the docs and creating a user pool I am running into some issues. 我正在玩Amazon Cognito,在阅读了一些文档和创建用户池后,我遇到了一些问题。 I believe that a cognito user pool can be used with OpenId to redirect the user to a hosted UI for user authentication (without federating out to another provider). 我相信Cognito用户池可以与OpenId一起使用,将用户重定向到托管UI以进行用户身份验证(无需联合到其他提供商)。 I have tried to use the authentication options in DotNetCore 2 to do this as this is something I have done previous with other providers. 我曾尝试使用DotNetCore 2中的身份验证选项来执行此操作,因为这是我之前与其他提供程序所做的事情。

I have the following: 我有以下内容:

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;
});

but everytime I try it always returns 但每次我尝试它总是返回

{"code":"BadRequest","message":"The server did not understand the operation that was requested.","type":"client"}

Just wondering if anyone had any experience with this please? 只是想知道是否有人有这方面的经验吗? I have tried to create the user pool in different regions just to make sure that it is not only supported in certain regions but always get the same. 我试图在不同的地区创建用户池,以确保它不仅在某些地区得到支持,而且总是得到相同的。

I used to have the same problem. 我曾经有过同样的问题。 Configured my pool and code according to this tutorial. 根据教程配置我的池和代码。 The crucial part was 关键部分是

Another configuration that may be important is the App integration > Domain name. 另一个可能很重要的配置是App集成>域名。 It allows us to configure what will be the domain of the sign-in and sign-up pages. 它允许我们配置登录和注册页面的域名。

After I configured domian name everything worked fine. 我配置多米安名称后一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM