Home

Listen to auth events

Receive a notification every time an auth event happens.

  • Types of auth events: SIGNED_IN, SIGNED_OUT, TOKEN_REFRESHED, USER_UPDATED, PASSWORD_RECOVERY
  • Currently, onAuthStateChange() does not work across tabs. For instance, in the case of a password reset flow, the original tab which requested for the password reset link will not receive the SIGNED_IN and PASSWORD_RECOVERY event when the user clicks on the link.
Parameters
  • callback
    REQUIRED
    function

    A callback function to be invoked when an auth event happens.


supabase.auth.onAuthStateChange((event, session) => {
  console.log(event, session)
})
Need some help?

Not to worry, our specialist engineers are here to help. Submit a support ticket through the Dashboard.