我想将 Cognito 用户池的登录选项设置为同时包含用户名和电子邮件。因此,当用户注册时,他们将被要求输入电子邮件、用户名和密码。
我似乎可以通过AWS控制台进行设置,但无法通过无服务器或云形成找出设置(因为我认为无服务器在幕后使用此设置?)
我有当前的无服务器配置,它创建一个包含用户名和密码的登录主机 UI 注册表单:
CognitoUserPool:
Type: 'AWS::Cognito::UserPool'
Properties:
UserPoolName: 'MyAppUserPool${self:custom.stage}'
UsernameConfiguration:
CaseSensitive: false
AutoVerifiedAttributes:
- 'email'
Policies:
PasswordPolicy:
MinimumLength: 8
RequireUppercase: true
RequireLowercase: true
RequireNumbers: true
RequireSymbols: true
CognitoUserPoolClient:
Type: 'AWS::Cognito::UserPoolClient'
Properties:
ClientName: 'MyAppUserPoolClient${self:custom.stage}'
GenerateSecret: true
UserPoolId:
Ref: 'CognitoUserPool'
CallbackURLs:
- 'http://localhost:3000/api/auth/callback/cognito'
SupportedIdentityProviders:
- 'COGNITO'
AllowedOAuthFlowsUserPoolClient: true
AllowedOAuthFlows:
- 'code'
- 'implicit'
AllowedOAuthScopes:
- 'email'
- 'openid'
- 'profile'
CognitoUserPoolDomain:
Type: 'AWS::Cognito::UserPoolDomain'
Properties:
Domain: 'my-app-${self:custom.stage}'
UserPoolId:
Ref: 'CognitoUserPool'
我可以设置以下内容,但这使它只有电子邮件和密码用于注册(删除用户名:
UsernameAttributes:
- 'email'
我试图在此处云形成文档中找到配置选项,但似乎看不到任何允许配置用户池登录选项的内容。
任何有关如何使用用户名和电子邮件托管 UI 的帮助将不胜感激,谢谢。