Ashutosh
Ashutosh

Reputation: 4675

Cognito: Amplify user creation in Angular

I'm trying to create Cognito user using Amplify in Angular.

Here is the code:

const { user } = await Auth.signUp({
   username,
   password,
   attributes: {
      name,
      email,          // optional
      phone_number,   // optional - E.164 number convention
      // other custom attributes 
   }
});

This creates the user in Cognito with Account Status: UNCONFIRMED

Where as if we create the user directly in Cognito, its Account Status: FORCE_CHANGE_PASSWORD

We need to set the Account Status: FORCE_CHANGE_PASSWORD

when user is created from Angular. The response is this:

CodeDeliveryDetails: {
    AttributeName: "email", DeliveryMedium: "EMAIL", Destination: "t***@d***.com"
},
AttributeName: "email"
DeliveryMedium: "EMAIL"
Destination: "t***@d***.com"
UserConfirmed: false
UserSub: "ab148f86-f66b-4f11-b6f0-510b2a770e48"

Upvotes: 0

Views: 386

Answers (1)

Jebasuthan
Jebasuthan

Reputation: 5604

When new user signup in aws-cognito if you turn on Multi Factor Authentication the default account status is UNCONFIRMED. You have to confirm with OTP through email or mobile number then only the account status will change from UNCONFIRMED to CONFIRMED

enter image description here

You can configure MFA under general settings --> MFA and verifications

Upvotes: 0

Related Questions