[英]AWS Cognito Identity Pool: How to check if email attribute is verified or not
Our android app currently requires admin to confirm users before logging in the app through aws cognito. 我们的android应用当前需要管理员通过aws cognito登录应用之前确认用户。 Users can then successfully login even though the email attribute is not verified. 即使没有验证电子邮件属性,用户也可以成功登录。 I don't have a problem requesting verification code or verifying users using the verification code. 请求验证码或使用验证码验证用户没有问题。
My problem is how to check if a currently logged-in email is verified or not? 我的问题是如何检查当前登录的电子邮件是否经过验证?
I searched a lot but cannot find anything. 我搜索了很多,但找不到任何东西。
You can get the user's attributes by calling getDetails
on the CognitoUser
instance providing it with a GetDetailsHandler
. 你可以通过调用获取用户的属性getDetails
在CognitoUser
实例为它提供一个GetDetailsHandler
。 This handler will be called with map of user attributes. 将使用用户属性映射来调用此处理程序。 Look for the following attributes: 查找以下属性:
phone_number_verified
email_verified
See the API docs here https://docs.aws.amazon.com/AWSAndroidSDK/latest/javadoc/ 在此处查看API文档https://docs.aws.amazon.com/AWSAndroidSDK/latest/javadoc/
Note Confirmation can also be automated using the pre-signup
lambda hook - this is called auto confirm
. 注意确认也可以使用pre-signup
lambda挂钩自动进行-这称为auto confirm
。 See: 看到:
https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-lambda-trigger-syntax-pre-signup.html https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-lambda-trigger-syntax-pre-signup.html
https://docs.aws.amazon.com/cognito/latest/developerguide/signing-up-users-in-your-app.html#confirming-user-without-verification-of-email-or-phone-number https://docs.aws.amazon.com/cognito/latest/developerguide/signing-up-users-in-your-app.html#confirming-user-without-verification-of-email-or-phone-number
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.