© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•7mo ago•
10 replies
Muezz

tRPC with Supabase Auth

I am unable to sign in as I am trying to set up my project with tRPC. Here is the procedure where I am making the call:
export const authRouter = createTRPCRouter({
  login: publicProcedure
    .input(
      z.object({
        email: z.string().email(),
        password: z.string().min(1).max(25),
      })
    )
    .mutation(async ({ input }) => {
      const sp = await createClient();
      const { data, error } = await sp.auth.signInWithPassword({
        email: input.email,
        password: input.password,
      });
      if (error) handleUnknownError(error);
      revalidatePath("/", "layout");
      return { success: true, user: data.user };
    }),
});
export const authRouter = createTRPCRouter({
  login: publicProcedure
    .input(
      z.object({
        email: z.string().email(),
        password: z.string().min(1).max(25),
      })
    )
    .mutation(async ({ input }) => {
      const sp = await createClient();
      const { data, error } = await sp.auth.signInWithPassword({
        email: input.email,
        password: input.password,
      });
      if (error) handleUnknownError(error);
      revalidatePath("/", "layout");
      return { success: true, user: data.user };
    }),
});


Even though this runs without any errors, there is no session/cookie in the browser.

I think this may be because Nextjs does not allow usage and setting of cookies outside of server actions and route handlers.

What can I do to get around this?
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

Struggling with supabase auth authentication loop.
SupabaseSSupabase / help-and-questions
4mo ago
Google Authentication paired with Supabase Auth
SupabaseSSupabase / help-and-questions
8mo ago
Supabase Auth instead of Auth0?
SupabaseSSupabase / help-and-questions
7mo ago
Steam Auth with Supabase auth.
SupabaseSSupabase / help-and-questions
2y ago