Name:
interface
Value:
Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Page updated Jun 19, 2024

Sign-up

Amplify provides a client library that enables you to interact with backend resources such as Amplify Auth.

To get started, you can use the signUp() API to create a new user in your backend:

import { signUp } from "aws-amplify/auth"
const { isSignUpComplete, userId, nextStep } = await signUp({
username: "hello@mycompany.com",
password: "hunter2",
options: {
userAttributes: {
email: "hello@mycompany.com",
phone_number: "+15555555555" // E.164 number convention
},
}
});

The signUp API response will include a nextStep property, which can be used to determine if further action is required. It may return the following next steps:

  • CONFIRM_SIGN_UP - The sign up needs to be confirmed by collecting a code from the user and calling confirmSignUp.
  • DONE - The sign up process has been fully completed.
  • COMPLETE_AUTO_SIGN_IN - The sign up process needs to complete by invoking the autoSignIn API.

Confirm sign-up

By default, each user that signs up remains in the unconfirmed status until they verify with a confirmation code that was sent to their email or phone number. The following are the default verification methods used when either phone or email are used as loginWith options.

Login optionUser account verification channel
phonePhone Number
emailEmail
email and phoneEmail

You can confirm the sign-up after receiving a confirmation code from the user:

import { confirmSignUp } from 'aws-amplify/auth';
const { isSignUpComplete, nextStep } = await confirmSignUp({
username: "hello@mycompany.com",
confirmationCode: "123456"
});

Note: When specifying email or phone as a way for your users to sign-in, these are attributes that are used in place of the username. Visit the concepts page to learn more about usernames.