From e70d98c2dc9e6f145133331c2253ca55b60a48e1 Mon Sep 17 00:00:00 2001 From: Pablo Cuadrado Date: Thu, 15 Jul 2021 09:48:23 -0300 Subject: [PATCH] Add an "email change" example in the GoTrue docs --- web/spec/gotrue.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/web/spec/gotrue.yml b/web/spec/gotrue.yml index 0331fa16f59..9941a786f20 100644 --- a/web/spec/gotrue.yml +++ b/web/spec/gotrue.yml @@ -291,6 +291,22 @@ pages: api.updateUser: $ref: '"GoTrueApi".GoTrueApi.updateUser' + notes: | + 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: + + `?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: + + ```js + const { error, data } = await supabase.auth.update({ + email_change_token: emailChangeToken, + }); + ``` examples: - name: Update user info that Gotrue holds (also used for setting new passwords) js: |