Can you mix server-side client with client-side client (NextJS)?

Login is implemented as a server action:
 const { data, error } = await supabase.auth.signInWithPassword({
    email,
    password,
  });


State change listener is implemented in a client component:
  useEffect(() => {
    const { data: listener } = supabaseClient.auth.onAuthStateChange((_event, session) => {
      console.log('auth change', { session });
    });

    return () => {
      listener?.subscription.unsubscribe();
    };
  }, [supabaseClient]);


There are no auth events fireing. Is that expected? Should I be handling everything with server-side only?
Was this page helpful?