Back to Blog

Authentication with Supabase

Add Google sign-in, magic links, and protected routes with Supabase Auth using the helpers already wired into Indiexyz.

Posted by

Related reading

Ship with the App Router

Use server components, nested layouts, and streaming in the Next.js App Router to build fast pages with less client JavaScript.

Connect Stripe Checkout

Use Stripe Checkout to accept one-time payments and subscriptions with hosted payment pages, webhooks, and production-ready success routing.

Optimize Core Web Vitals

Improve LCP, INP, and CLS with measurable budgets, prioritized images and scripts, and a release workflow that catches regressions early.

Illustration of a sign-in screen and authenticated user

Start with the happy path

Indiexyz's Supabase integration separates public pages from protected dashboard pages. That makes it easier to reason about session checks, redirects, and user-specific data access.

1. Configure providers

In Supabase, enable the providers you want to launch with. For Google OAuth, add your production callback URL first, then add localhost as a secondary redirect for development.

https://indiexyz.com/auth/callback
http://localhost:3000/auth/callback

2. Protect by route groups

Keep dashboard pages behind a server session check and redirect unauthenticated visitors before rendering. This prevents both UI flashes and accidental client-side data fetching.

3. Treat profiles as product data

Create a profile row when a user is confirmed. Store only what your product needs, enforce row-level security, and make email address changes flow through a verified update process.