Skip to main content

resetPasswordForEmail()

Sends a reset request to an email address.

const { data, error } = await supabase.auth.api
.resetPasswordForEmail('user@email.com')

Parameters

  • emailrequiredstring

    The email address of the user.

  • optionsrequiredobject

    No description provided.

      Properties
    • captchaTokenoptionalstring

      No description provided.

    • redirectTooptionalstring

      No description provided.

Notes

Sends a reset request to an email address.

When the user clicks the reset link in the email they will be forwarded to:

<SITE_URL>#access_token=x&refresh_token=y&expires_in=z&token_type=bearer&type=recovery

Your app must detect type=recovery in the fragment and display a password reset form to the user.

You should then use the access_token in the url and new password to update the user as follows:

const { error, data } = await supabase.auth.api
.updateUser(access_token, { password : new_password })

Examples

Reset password

const { data, error } = await supabase.auth.api
.resetPasswordForEmail('user@email.com')