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 回答
1
已接受的回答

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.

已回答 2 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则