Detect email change event
Feature request
Is your feature request related to a problem? Please describe.
We should automatically detect an email_change_token in the web address and then handle the email update
Describe the solution you'd like
Updating the email field will cause a "Confirm Email Change" email to be sent to the new address.
When the user clicks the Confirm link in the Confirm Change email they will be forwarded to:
<SITE_URL>?email_change_token=x&type=email_change&redirect_to=y
Your app must detect the email_change_token in the search params. You should then use the email_change_token in the url to update the user's email as follows:
const { error, data } = await supabase.auth.update({
email_change_token: emailChangeToken,
});
Additional context
https://github.com/supabase/supabase/pull/2380
I don't see any changes in the GoTrue JS client w.r.t. handling email_change_token but it seems like we no longer need to update the email with the email_change_token. As users of the Supabase JS isomorphic client, do we still need to handle email_change_token on our own client code?
I'm not sure this is true? The email_change_token I believe is being consumed by GoTrue and confirming the email, after which point a redirect is made to your app. There shouldn't be any involvement of the JS library.
Is this still an issue? @kiwicopple @liaujianjie