Amazon Cognito:需要验证电子邮件和电话 [英] Amazon Cognito: Require verification of both email and phone

查看:34
本文介绍了Amazon Cognito:需要验证电子邮件和电话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果用户同时提供电子邮件和电话,我需要要求两者都经过验证.如果没有此处描述的额外步骤,似乎没有办法做到这一点

If a user provides both an email and phone, I need to require both to be verified. It looks like there isn't a way to do this without extra steps as described here

https:///docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-email-phone-verification.html

有没有办法要求两个验证?

Is there a way to require both verifications?

目前看来要等电话号码验证,先验证phoneNumber.之后调用initialAuth获取访问令牌以检索userInfo并检查电子邮件是否需要验证,并将验证码发送出去.从测试中,我看到电子邮件验证不会阻止发起身份验证请求,因此需要在每个发起身份验证请求之前发出 getUser 请求,以查看是否需要验证,如果电子邮件仍需要验证,则不返回访问令牌.

Currently it looks like I have to wait for phone number to be verified, verify phoneNumbber first. After that call initiateAuth to get an access token to retrieve the userInfo and check if email needs verification, and send verification code out. From testing I saw that email verification does not block the initiateAuth request so a getUser request would need to be made before every initiateAuth request to see if verification is needed and not return an access token if email still needs verification.

推荐答案

我在 Cognito 团队.所描述的场景此时是不可能的(需要在登录前验证电子邮件和电话号码).如果电话号码和电子邮件都需要验证,如果用户属性中存在电话号码,则将验证码发送到电话号码,优先考虑.此外,可以让您验证电子邮件的 verifyUserAttribute 调用需要使用 AccessToken 将电子邮件标记为已验证.

I am on the Cognito team. The scenario described is not possible at this point (requiring email and phone number verification before sign in). If both phone number and email require verification, if a phone number is present in the user attributes, the verification code is sent to the phone number, it is prioritized. Also, the calls to verifyUserAttribute which would enable you to verify email require an AccessToken to mark email as verified.

这篇关于Amazon Cognito:需要验证电子邮件和电话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆