amazon-archives / amazon-cognito-auth-js

The Amazon Cognito Auth SDK for JavaScript simplifies adding sign-up, sign-in with user profile functionality to web apps.
Apache License 2.0
424 stars 232 forks source link

How to do email attribute verification and change atomically? #212

Closed ronkot closed 4 years ago

ronkot commented 4 years ago

We use the user email attribute to log in user. We also have functionality so that users can change their email. AFAIK the change has to be done so that we first update the new email attribute to cognito (which also sets the email_verified attribute to false) and only after that we can verify the new email using verification code or link.

Now the problem is, that sometimes users just initiate the email change process and never verify the new email. This leads to situation where user has new email in cognito, but email_verified attribute is false. Thus, user can't log in anymore using his email 😞

Is there some way to tell cognito: "change user email attribute to X if the verification process succeeds"?

(I'm using Amplify library, but I think this issue belongs to amazon-cognito-auth-js level)

ronkot commented 4 years ago

Now I found that there's already been discussion about the same problem in amplilfy repo (for example, https://github.com/aws-amplify/amplify-js/issues/987).

Closing as this doesn't offer any new information.

ronkot commented 4 years ago

And for anyone seeking for solution to my question, here's a (hacky) one that really works as expected: https://github.com/aws-amplify/amplify-js/issues/987#issuecomment-508059168