amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

How to enable username login and how to check whether username avaliable or not?

Open AsitDixit opened this issue 3 years ago • 3 comments

Note: If your question is regarding the AWS Amplify Console service, please log it in the AWS Amplify Console repository

Which Category is your question related to?

Amplify CLI Version

You can use amplify -v to check the amplify cli version on your system

What AWS Services are you utilizing?

Provide additional details e.g. code snippets. Be sure to remove any sensitive data.

AsitDixit avatar Jul 09 '22 17:07 AsitDixit

Hey @AsitDixit :wave: you can use username as a login mechanism by selecting username when creating the auth resource with amplify add auth (https://docs.amplify.aws/cli/auth/overview/)

Can you clarify the second question? Are you looking to validate whether username was selected when you previously created an auth resource?

josefaidt avatar Jul 11 '22 13:07 josefaidt

@josefaidt Yes I want to run query whether user name is available or not and that username you said is immutable basically I am asking about preferred_username

AsitDixit avatar Jul 12 '22 17:07 AsitDixit

Hey @AsitDixit apologies for the delay here, are you looking to have unique preferred_username attributes? This approach may create an additional attack vector for your app. We can also leverage a pre-signup trigger that uses the AWS SDK to call Cognito and see if this preferred_username is available

  • https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CognitoIdentity.html
  • https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/Welcome.html

josefaidt avatar Jul 27 '22 19:07 josefaidt

Hey @AsitDixit just wanted to follow-up on this one and see if you're still experiencing this issue?

josefaidt avatar Aug 23 '22 13:08 josefaidt

Solved

AsitDixit avatar Aug 23 '22 15:08 AsitDixit