Amplify-js: How to verify email address if user information does not exist

Created on 16 Feb 2019  路  3Comments  路  Source: aws-amplify/amplify-js

* Which Category is your question related to? *
It is related to the Auth module

* What AWS Services are you utilizing? *
Cognito and Identity Pool

* Provide additional details e.g. code snippets *
This is my scenario:

  1. User gives their details, including email address at the time of registration. I have Cognito set up such that they need to verify their email address and cannot proceed without a verification.
  2. So, once they register, I let them know that a verification code was sent to their email address and they need to provide it to confirm, before using the app
  3. Let us say that the user gives up (as in does NOT enter the verification code and quits) but later comes back to Login. When they try to login, they get an error saying the User is not confirmed.
  4. Now at this step, I wish to allow the user to verify their email address. However, using
Auth.verifyCurrentUserAttribute({ email: "email@address" })

seems to return an error saying No current user. My guess is that this method is to be used only once the user has been logged in. In my scenario, how can they proceed to confirm their email address if they missed confirming it during registration?

Auth

Most helpful comment

I am not getting the option to reopen this ticket. But I get a feeling that what I am looking for is not currently supported

The issue with the solution that you have proposed is that Auth.confirmSignUp() expects the code - correct me if I am wrong, but doesn't the code expire after a period of time - Also, what I am looking at is sending the confirmation code through email once more (say the user accidentally deleted it or it got caught by their spam filter and they are unaware about it and would like to get the confirmation code once again). I could not determine if the ability to send the confirmation code again exists, if the user has come out of the registration page...

All 3 comments

@callmekatootie I believe Auth.verifyCurrentUserAttribute is used to verify and attribute or attributes for a user who has already been confirmed in the signup process. Instead, try calling Auth.confirmSignUp like so:

        Auth.confirmSignUp(username, code)
            .then(() => { 
                 // do something...
             })
            .catch(err => yourErrorHandler(err));

Whether or not you need to have them proceed to confirm their email address after this depends on your configuration.

I'm closing this for now, but please feel free to reopen if this doesn't address your issue.

I am not getting the option to reopen this ticket. But I get a feeling that what I am looking for is not currently supported

The issue with the solution that you have proposed is that Auth.confirmSignUp() expects the code - correct me if I am wrong, but doesn't the code expire after a period of time - Also, what I am looking at is sending the confirmation code through email once more (say the user accidentally deleted it or it got caught by their spam filter and they are unaware about it and would like to get the confirmation code once again). I could not determine if the ability to send the confirmation code again exists, if the user has come out of the registration page...

Just hit this and landed here. here's the solution:

Auth.verifyCurrentUserAttribute('email').then((data) => {
// do something
.catch(err =>{
//handle err
}

It'll send you a code. Then use is it in

Auth.verifyCurrentUserAttributeSubmit('email', this.code).then ....
Was this page helpful?
0 / 5 - 0 ratings

Related issues

karlmosenbacher picture karlmosenbacher  路  3Comments

romainquellec picture romainquellec  路  3Comments

josoroma picture josoroma  路  3Comments

ldgarcia picture ldgarcia  路  3Comments

epicfaace picture epicfaace  路  3Comments