Questions regarding email change and checking if email is verified #31356
Unanswered
Alexandre-Chapelle
asked this question in
Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey!
FLOW
Could anyone please confirm if this flow is correct or completely wrong? I checked many repositories on GitHub and read the official documentation, but I couldn't find any proper working examples.
I have a feature where the user can change their email address. The flow is as follows:
The user presses the "Change Email" button.
The user enters a new email address.
Check if the user has MFA enabled:
Send OTP verification codes to both the old and new email addresses using:
supabase.auth.updateUser({ email })
Ask the user to enter both OTP codes manually (note that the email template was modified to include only the TOKEN) and verify them using:
supabase.auth.verifyOtp({ oldEmail, oldEmailOtpCode, "email_change" })
supabase.auth.verifyOtp({ newEmail, newEmailOtpCode, "email_change" })
If successful, show a success dialog.
ISSUE
After the email change process is completed, the
email_confirmed_at
field is set to true, but theuser_metadata.email_verified
field is still false.Could anyone help me understand the proper way to check if the user's email is verified or a way to update metadata?
CURRENT CODE:
OTHER
Additionally, if anyone has a fully functional open-source project that demonstrates full use of supabase, including:
...
I would really appreciate it if someone could share it with me.
Beta Was this translation helpful? Give feedback.
All reactions