© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•13mo ago•
4 replies
mikirejf

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,
  });
 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]);
  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?
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

NextJS: User data client side?
SupabaseSSupabase / help-and-questions
2y ago
Does server-side authentication work in tendom with client-side?
SupabaseSSupabase / help-and-questions
4y ago
Using Supabase in NextJS Server Side
SupabaseSSupabase / help-and-questions
13mo ago
Client vs server-side database queries with Supabase
SupabaseSSupabase / help-and-questions
3y ago