SupabaseS
Supabase•4y ago
FunHellion

Password Recovery

Hi there 👋

I am working on password recovery in React and it's well documented how that is supposed to work but for some reason it is not working for me.

The example shows that using the onAuthStateChange event is the way to handle incomming recovery requests.

I tried putting a console.log in there so I could see if the event even happens, but it just does not show up.

useEffect(() => {
  supabase.auth.onAuthStateChange(async (event, session) => {
    console.log('AUTH STATE CHANGE', event, session);

    if (event === 'PASSWORD_RECOVERY') {
      alert('It works');
    }
  });
}, []);


Any ideas on what might be wrong?

https://supabase.com/docs/reference/javascript/auth-api-resetpasswordforemail#reset-password-react
Sends a reset request to an email address.
Was this page helpful?