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 Antwort
1
Akzeptierte Antwort

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.

beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen