Can we make username=sub?

0

I am using ForceAliasCreation and only required attribute is email for signup. User can sign in through preferred_username and email. But During sign-up it is asking a username that is not preferred_username & that is immutable. After email conformation user can chose their preferred_username. Now this is very odd that one user have 2 username one is immutable and other is mutable. Preferred username makes sense because user can change it later on.So I don't want to tell user that username required during signup instead I will make it equals to sub .Is it possible?

1 Answer
1
Accepted Answer

Hello,

I understand your confusion regarding Cognito and the attributes required for a User. It is important to note that regardless of how you want the User to sign in or sign up for your User Pool, each user must have an immutable Username. That required Username serves as a unique identifier for each User in a User Pool.

preferred_username when not required is an alias, an attribute that can be used in place of the Username when signing in which is why it is easily changeable. Because Username is an immutable element that needs to be uniquely defined, I would not recommend redefining it to equal a static variable.

Feel free to reach out if you have any other questions.

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions