GuidesAuthentication
Forgot and Reset Password
This guide will help you manage password recovery in the React Native Supabase AI template, providing flexibility to customize reset emails and redirect URLs for a seamless user experience. Follow the steps below to configure and enhance your password reset flows.
Overview
In a React Native Supabase AI application, users who sign in using the email-password method may sometimes forget their password. The template provides a password reset feature to handle such scenarios.
Password Reset Process
-
Triggering Password Reset
- Users who forget their password can initiate a reset by entering their registered email address.
- The system sends an email with a One-Time Password (OTP).
- Note: This feature is only available for users who have signed in using the email-password method.
-
Supabase Password Reset Method
- The password reset function is powered by the
supabase.auth.resetPasswordForEmail
method in the React Native Supabase AI template. - Ensure that all relevant Supabase environment variables are correctly set for local and production environments.
- The password reset function is powered by the
Customizing Email Template
Supabase provides options to customize the content of the password reset email:
Supabase Dashboard
- You can edit the email template by navigating to the following path in the Supabase dashboard:
https://supabase.com/dashboard/project/{projectID}/auth/templates
- Modify the subject and body of the reset password email directly from the dashboard.
Local Template
- To configure email templates locally, open the
config.toml
file located in thesupabase/templates
folder. - Below is an example configuration for the reset password email:
- Below is an example of an HTML email template for OTP-based password reset. You can use the same template in production.