question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Confirm sign up empty code

See original GitHub issue

Describe the bug When using email and password with amplify the auth.ConfirmSignUp part doesn’t work as part of the workflow.

To Reproduce Steps to reproduce the behavior:

My logs. email x@googlemail.com authCode_passcodescreen 716541 Authcode before signin 716541 Error when entering confirmation code: Code cannot be empty authCode 716541 email px@googlemail.com authCode_passcodescreen 111111 Authcode before signin 111111 Error when entering confirmation code: Code cannot be empty authCode 111111

Here is the authentication piece of code.

  console.log("Authcode before signin", authCode);
  await Auth.confirmSignUp({ username: email, authCode: parseInt(authCode) })
    .then(data => {
      console.log("data", data);
      navigation.navigate("SignIn");
      console.log("Confirm sign up successful");
    })
    .catch(err => {
      if (!err.message) {
        console.log("Error when entering confirmation code: ", err);
        console.log("authCode", authCode);
        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);
      }
    });
};```
And the pertinent code from the Passcode part of the screen.

``` async confirmSignUp() {
    if (
      this.state.passCode1 == -1 ||
      this.state.passCode2 == -1 ||
      this.state.passCode3 == -1 ||
      this.state.passCode4 == -1 ||
      this.state.passCode5 == -1 ||
      this.state.passCode6 == -1
    ) {
      Alert.alert("Please enter 6 digit passcode.");
    } else {
      //let { state } = this.props.navigation;
      //   console.error();
      //const {username, authCode} = this.state
      //const { username } = this.state;
      let email = this.state.email;
      console.log("email", email);
      let authCode =
        this.state.passCode1 +
        "" +
        this.state.passCode2 +
        "" +
        this.state.passCode3 +
        "" +
        this.state.passCode4 +
        "" +
        this.state.passCode5 +
        "" +
        this.state.passCode6;
      //let authCode2 = parseInt(authCode);
      console.log("authCode_passcodescreen", authCode);
      this.props.confirmSignUp({ username: email }, authCode, this.props.navigation);
    }
  }

Expected behavior Previously when I was using username, this code worked. I’m confused why the authCode is printed to the logs but isn’t being passed around.

https://github.com/aws-amplify/amplify-js/issues/1924 seems to be a similar issue. Screenshots Screenshot 2019-07-30 15 32 19

Using the IPhone simulator with Iphone 7. On my Mac OSX.

   "AppVersion": "ios/12.2",
   "Make": "iPhone",
   "Model": "iPhone 6/7/8 plus",
   "ModelVersion": "12.2",
   "Platform": "ios",
 }

You can turn on the debug mode to provide more info for us by setting window.LOG_LEVEL = ‘DEBUG’; in your app.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
dabit3commented, Jul 31, 2019

Not sure if I’m reading this wrong, but I think that Auth.confirmSignup needs to have just the values passed directly in as args, i.e. instead of:

Auth.confirmSignUp({ username: email, authCode: parseInt(authCode) })

Try

Auth.confirmSignUp(email, parseInt(authCode))
1reaction
springcoilcommented, Aug 1, 2019

Well the bug seemed to disappear. Maybe a caching issue or something?

On Thu, 1 Aug 2019, 2:58 pm Nader Dabit, notifications@github.com wrote:

Hey @springcoil https://github.com/springcoil, re: just time fixed the issue, can you elaborate? Thanks,

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aws-amplify/amplify-js/issues/3771?email_source=notifications&email_token=AAHQHCDJ2UYTOZAJE7VB2KTQCLTW7A5CNFSM4IIFX3G2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3KV2RY#issuecomment-517299527, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHQHCDJYPJZU6XVBRWX7ILQCLTW7ANCNFSM4IIFX3GQ .

Read more comments on GitHub >

github_iconTop Results From Across the Web

ConfirmSignUp - Amazon Cognito User Pools
The confirmation code sent by a user's request to confirm registration. Type: String. Length Constraints: Minimum length of 1. Maximum length of 2048....
Read more >
validate email address – check if empty - php - Stack Overflow
"name" is a required attribute on input elements, and is necessary to get the parameter in the request. To elaborate: id="signup-email" is ...
Read more >
Password is empty click to login button automatically show ...
Password is empty click to login button automatically show next page, how to check password - CodeProject.
Read more >
JavaScript : HTML form - Checking for non empty - w3resource
You can write a JavaScript form validation script to check whether the required field(s) in the HTML form is blank or not.
Read more >
How to Check if Object is Empty in JavaScript - Samantha Ming
Here's a Code Recipe to check if an object is empty or not. ... What is Vanilla JavaScript; A. Empty Object Check in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found