How to use the @aws-amplify/auth.confirmSignUp function in @aws-amplify/auth

To help you get started, we’ve selected a few @aws-amplify/auth examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yhenni1989 / ReactNativeAuth / src / components / screens / SignUpScreen.js View on Github external
async confirmSignUp() {
    const { username, authCode } = this.state
    await Auth.confirmSignUp(username, authCode)
    .then(() => {
      this.props.navigation.navigate('SignIn')
      console.log('Confirm sign up successful')
    })
    .catch(err => {
      if (! err.message) {
        console.log('Error when entering confirmation code: ', err)
        Alert.alert('Error when entering confirmation code: ', err)
      } else {
        console.log('Error when entering confirmation code: ', err.message)
        Alert.alert('Error when entering confirmation code: ', err.message)
      }
    })
  }
  // Resend code if not received already
github TreeHacks / root / src / Verify.tsx View on Github external
verify() {
        // http://localhost:9000/verify?username=910e6571-c11e-4c83-9e27-cf220bdd6e41&code=315131
        const { username, code } = queryString.parse(window.location.search);
        Auth.confirmSignUp(username, code, {
            // Optional. Force user confirmation irrespective of existing alias. By default set to True.
            forceAliasCreation: true
        }).then(data => {
            console.log(data);
            this.setState({ verified: true });
        })
            .catch(err => {
                this.setState({ verified: false, error: err.code + " - " + err.message });
            });

    }
    render() {
github TreeHacks / root / src / store / auth / actions.ts View on Github external
return dispatch => {
    dispatch(loadingStart());
    let email = data.email.toLowerCase().trim();
    let dummyCode = "_";
    Auth.confirmSignUp(email, dummyCode, {
      forceAliasCreation: false
    }).catch(err => {
        if(err.code === "UserNotFoundException") {
          dispatch(setAuthPage("signUp", "Welcome to TreeHacks! Enter the rest of your info to sign up. (Note: You must be a current undergraduate or graduate student to attend TreeHacks.)"));
          dispatch(loadingEnd());
        } else {
          dispatch(setAuthPage("signIn", "Welcome back! Please enter your password to continue."));
          dispatch(loadingEnd());
        }
      });
  }
}
github aws-amplify / amplify-js / packages / aws-amplify-react / src / Auth / ConfirmSignUp.jsx View on Github external
confirm() {
        const username = this.usernameFromAuthData() || this.inputs.username;
        const { code } = this.inputs;
        if (!Auth || typeof Auth.confirmSignUp !== 'function') {
            throw new Error('No Auth module found, please ensure @aws-amplify/auth is imported');
        }

        Auth.confirmSignUp(username, code)
            .then(() => this.changeState('signedUp'))
            .catch(err => this.error(err));
    }
github awslabs / aws-full-stack-template / assets / src / modules / signup / Signup.tsx View on Github external
onConfirm = async (event: React.FormEvent) => {
    event.preventDefault();
    this.setState({ loading: true });

    try {
      await Auth.confirmSignUp(this.state.email, this.state.confirmationCode);
      await Auth.signIn(this.state.email, this.state.password);
      this.props.userHasAuthenticated(true);
      this.setState({ redirect: true })
    } catch (e) {
      alert(e.message);
      this.setState({ loading: false });
    }
  }