DEV Community

Discussion on: The Complete Guide to User Authentication with the Amplify Framework

Collapse
 
rtdemetri profile image
Demetrios Christopher

In your .then(), provide an onRejected clause:

Auth.currentAuthenticatedUser().then((user) => { ... }, (error) => { ... }).catch((error) => { ... })

The catch is there to catch something wrong that you did in your onResolved or onRejected clauses, not to catch the fact that the promise was rejected and never resolved. I hope this helps!

Alternatively, you can turn the promises into observables and deal with them as such.