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 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南