- Newest
- Most votes
- Most comments
Great questions! Let's break down your scenario and address each point:
1. SignIn with Both Email and Phone Number
If you configure AWS Cognito to accept both email and phone number for SignIn but require only the email attribute for SignUp, users will still be able to register and log in using either their email or phone number. This is because Cognito allows flexibility in SignIn options, and you can configure it to accept multiple identifiers for authentication.
2. User Storage in Cognito Database
When users register, even if they only provide an email during SignUp, they can later add a phone number to their account. Cognito will store both attributes and associate them with the same user account. This means that users can log in using either their email or phone number, and Cognito will correctly identify and authenticate them.
Handling Third-Party Authentication
Regarding the issue with Facebook authentication, the error occurs because Cognito expects a phone number if it's set as a required attribute. By configuring Cognito to require only the email for SignUp, you should be able to integrate Facebook authentication without issues. This setup will allow users to SignIn with either their email or phone number, even if they initially registered using Facebook (which doesn't provide a phone number attribute).
Relevant content
- asked 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
I'm creating an aws amplify gen 2 nextjs app, where I have similar usecase, I want the user to signup using either email or phone. Having said that, I have enabled both email and phone number for cognito user pool. I tried to signup with phone number, it is working fine. However, later I added my email, got it verified via code, it does not allow me to login with email and password now. I tried to add the email under preferred_username as well, still there is no luck. I'm not sure what exactly I'm missing