我正在进行无服务器身份验证,但在发送确认电子邮件时遇到问题。当我通过 AWS 控制台创建用户时,会创建用户并发送带有确认码的电子邮件。但是当我向 API 发出请求时,在 Cognito 中创建了用户,但没有发送电子邮件。我的代码或请求可能有什么问题?
这是 serverless.yml 中定义的 Cognito 资源:
CognitoUserPool:
Type: AWS::Cognito::UserPool
Properties:
UserPoolName: ${self:service}-${self:provider.stage}-user-pool
UsernameAttributes:
- email
AutoVerifiedAttributes:
- email
EmailConfiguration:
EmailSendingAccount: COGNITO_DEFAULT
这是我发送给 API 的请求:
POST / HTTP/1.1
Host: cognito-idp.eu-central-1.amazonaws.com
X-Amz-Target: AWSCognitoIdentityProviderService.SignUp
X-Amz-User-Agent: aws-amplify/0.1.x js amplify-authenticator
Content-Type: application/x-amz-json-1.1
Content-Length: ###
{
"ClientId": "####################",
"Username": "######@###.##",
"Password": "####################",
"ValidationData": null
}