The signInOutput.
Amplify.configure({
Auth: {
Cognito: {
...cognitoConfig,
signUpVerificationMethod: "link" // the default value is "code"
}
}});
AutoSignInException - Thrown when the autoSignIn flow has not started, or has been cancelled/completed.
// handleSignUp.ts
async function handleSignUp(
username:string,
password:string
){
try {
const { nextStep } = await signUp({
username,
password,
options: {
userAttributes:{ email:'email@email.com'},
autoSignIn: true // This enables the auto sign-in flow.
},
});
handleSignUpStep(nextStep);
} catch (error) {
console.log(error);
}
}
// handleConfirmSignUp.ts
async function handleConfirmSignUp(username:string, confirmationCode:string) {
try {
const { nextStep } = await confirmSignUp({
username,
confirmationCode,
});
handleSignUpStep(nextStep);
} catch (error) {
console.log(error);
}
}
// signUpUtils.ts
async function handleSignUpStep( step: SignUpOutput["nextStep"]) {
switch (step.signUpStep) {
case "CONFIRM_SIGN_UP":
// Redirect end-user to confirm-sign up screen.
case "COMPLETE_AUTO_SIGN_IN":
const codeDeliveryDetails = step.codeDeliveryDetails;
if (codeDeliveryDetails) {
// Redirect user to confirm-sign-up with link screen.
}
const signInOutput = await autoSignIn();
// handle sign-in steps
}
Signs a user in automatically after finishing the sign-up process.
This API will automatically sign a user in if the autoSignIn flow has been completed in the following cases:
Messaging
tab and enablelink
mode inside theVerification message
option. Finally you need to define thesignUpVerificationMethod
in yourAuth
config.