Receive a notification every time an auth event happens.
AuthChangeEvent.passwordRecovery
, AuthChangeEvent.signedIn
, AuthChangeEvent.signedOut
, AuthChangeEvent.tokenRefreshed
, AuthChangeEvent.userUpdated
and AuthChangeEvent.userDeleted
final authSubscription = supabase.auth.onAuthStateChange.listen((data) {
final AuthChangeEvent event = data.event;
final Session? session = data.session;
});
final authSubscription = supabase.auth.onAuthStateChange.listen((data) {
final AuthChangeEvent event = data.event;
if (event == AuthChangeEvent.signedIn) {
// handle signIn
}
});
final authSubscription = supabase.auth.onAuthStateChange((event, session) {});
authSubscription.cancel();