Email option not available for "How do you want your end users to sign in?" using amplify add auth.
When configuring auth using this cli, the option for end users to sign in via email is not available as a configuration choice in the setup flow. Why is this the case, and what's the proper way to make email the sign-in method? Should I just use the username sign-in method but enforce that usernames and emails are the same?
I am also interested in this option, is an option in awsmobile CLI but not in Amplify CLI.
UPDATE: I've found that, in the meantime, I can modify the cloudformation template in my local project repository, going to amplify/backend/auth/<project_name>/<project_name>-cloudformation-template.yml and adding right after the following lines:
Type: AWS::Cognito::UserPool
Properties:
UserPoolName: !Ref userPoolName
You can add:
AliasAttributes:
- 'email'
- 'phone_number'
save it and then issue the command:
amplify push
By no means this is a permanent solution, this is just to get it going using the tool and being able to sign-in with a verified email address or phone number until a final solution is in place.
When implmented, this should include email or phone_number options.
Will this end up using the UsernameAttributes?
I also need this. At the moment I can manually set up the "Users can use email as their "username" to sign up and sign in" option from the AWS console with MobileHub but I would really like to have the option to select it from the Amplify Cli especially since there are already the options to add other user attributes like given_name and family_name. Sign Up with email instead of a username is quite a standard case I think.
Is there any update on this request? Being able to use the Amplify Cli to set up sign in with an email address instead of username?

I also find this a very strange and frustrating limitation. I even tried to create a new cognito and replace the one in the setup doc, but it just ended up making a NEW cognito with that given name instead (overwriting the ids etc).
Finally figured this out looking at the template language.
Under Type: AWS::Cognito::UserPool set
UsernameAttributes:
- 'email'
This will create it with email instead of username setup.
link to documentation https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html
@angineering I am not sure I understand how you solved the problem? If you set up Cognito with the Amplify Cli (using the terminal and going through the custom set up options) it doesn't allow you to select Email as username. It gives you other options such as adding any attributes you want but not "Email as Username". Once Cognito is set up I don't seee how you can change the username setting... If you could explain in more detail how you did this I would be very grateful! Thanks
@tamsynjennifer I did what @gustavo-rios did above. Go through the cli steps, then manually edit the mplify/backend/auth/<project_name>/<project_name>-cloudformation-template.yml before doing amplify push
@angineering Thanks! I understand now. It worked for me too! :)
Is not working for me, I'm tried with both solutions
UserPool:
# Created upon user selection
# Depends on SNS Role for Arn if MFA is enabled
Type: AWS::Cognito::UserPool
Properties:
UserPoolName: !Ref userPoolName
AliasAttributes:
- 'email'
- 'phone_number'
UsernameAttributes:
- 'email'
Schema:
-
Name: family_name
Required: true
Mutable: true
I tried to use them separately
@rcanessa89 Did you edit the file before doing amplify push?
Any updates on this?
@rcanessa89 Only one of the aliasAttributes or usernameAttributes can be set in a User pool.
Hee is what I did to make this work (after trying many variations:
In the YML file, add the following to the list of variables at the top of the page
UsernameAttributes:
Type: CommaDelimitedList
Then, in the UserPool: section below, add the following:
UsernameAttributes: !Ref UsernameAttributes
Then, in the parameters.json file, add:
"UsernameAttributes": ["email"],
This worked for me
Adding the following to the CF template works:
UsernameAttributes:
- 'email'
However the builtin Amplify signup forms are not compatible... at least not the aws-amplify-vue component I've tried it with.
Even passing in a signUpFields array to try and force it to stop displaying the username field, it just sticks one in there anyway, along with a phone number saying they are both required (The Cognito console does not list them as required)
@comfytoday
not 100% sure if vue behaves the same as angular but there you need to set hideAllDefaults
like
signUpConfig = {
hideAllDefaults: true,
signUpFields: [
{
label: 'Name',
key: 'name',
required: true,
displayOrder: 1,
type: 'text',
},
{
label: 'Email',
key: 'username',
required: true,
displayOrder: 2,
type: 'email',
},
{
label: 'Password',
key: 'password',
required: true,
displayOrder: 3,
type: 'password',
}
]
};
@h0raz Thank you!
Saved me some explaining....
This is the config I used in Vue. Found reference in another Github issue. It doesn't appear to be documented on the Vue side.
signUpConfig: {
header: 'Sign Up',
hideDefaults: true,
signUpFields: [
{ ...
const signUpConfig = {
hiddenDefaults: ['username'],
signUpFields: [
{
label: 'Email',
key: 'username', // !!!
required: true,
displayOrder: 1,
type: 'string',
custom: false
},
{
label: 'Password',
key: 'password',
required: true,
displayOrder: 2,
type: 'password',
custom: false
},
{
label: 'Phone Number',
key: 'phone_number',
required: true,
displayOrder: 3,
type: 'tel',
custom: false
}
]
};
export default withAuthenticator(App, { signUpConfig });
And adding:

If anyone is wondering how they can replace Username label on the Login screen, you can "translate it":
I18n.setLanguage('en');
I18n.putVocabularies({
en: {
'Username': 'Email'
}
});