用户注册后如何在 aws cognito 中自动验证电子邮件。稍后状态后在 Cognito 中验证电子邮件
Posted
技术标签:
【中文标题】用户注册后如何在 aws cognito 中自动验证电子邮件。稍后状态后在 Cognito 中验证电子邮件【英文标题】:How to autoVerifyEmail in aws cognito after the user is signed up. Verify email in Cognito after later state 【发布时间】:2020-09-30 14:00:22 【问题描述】:我的用例:
我想在 AWS Cognito 中注册用户,并希望用户在注册过程中无需验证电子邮件即可继续完成该过程。
为了实现这一点,我让用户通过在 Cognito Presignup 触发器中添加 "autoConfirmUser": "true" 来继续该过程
在 Cognito 确认后触发器中,我使用 SES 发送 CustomVerificationEmail 让他验证电子邮件地址。
当用户在 SES 中验证他的电子邮件(状态 = 已验证)时,我想在 Cognito 中将 EmailVerified 更新为 true。 (稍后用于忘记密码用例)
如何以编程方式实现这一目标?比如 Lambda 或 SNS 触发的东西?
我不想像中提到的那样使用 AWS CLI, AWS Cognito - User stuck in CONFIRMED and email_verified = false
【问题讨论】:
【参考方案1】:请在 Cognito Presignup 触发器中将 autoVerifyEmail
添加为 true。
关注这个referance
nodejs中的示例代码
"use strict";
exports.handler = async (event) =>
event.response.autoConfirmUser = true;
event.response.autoVerifyEmail = true;
return event;
;
【讨论】:
谢谢,这是自动确认用户的最简单方法!以上是关于用户注册后如何在 aws cognito 中自动验证电子邮件。稍后状态后在 Cognito 中验证电子邮件的主要内容,如果未能解决你的问题,请参考以下文章
Swift - AWS Cognito 使用 Amplify - 如何在 swift 登录后获取令牌?
AWS Lambda、API 网关和 Cognito:如何在 lambda 函数中获取身份对象?