Current behavior:
I’m using Supabase authentication and storage to persist user sessions in my V0 project. It works fine in both deployed and preview environments—when I log in and refresh the page (F5), I remain logged in and see the dashboard (expected behavior).
However, when I start a new message or generate a new preview, the session is lost, and I’m redirected back to the login screen. This interrupts the flow and slows down my development.
Expected behavior:
Once a user is logged in on a preview, they should remain logged in—even when generating a new preview or starting a new message—so long as the preview environment isn’t truly sandboxed or cleared.
** Steps to reproduce**
- Deploy a V0 project using Supabase auth.
- Log in through the preview link.
- Refresh the page → user stays logged in
- Go back to V0, send a new message to continue building → generate a new preview
- Open the new preview → session is gone
** Project information**
- Project type: V0 project integrated with Supabase (not hosted on Vercel)
- Environment: Preview mode (in V0)
- Frontend: Next.js (App Router)
- Backend/auth: Supabase
- Session persistence: Using Supabase client-side storage (localStorage/session)
Questions
- Is this expected behavior from V0 (e.g., do new previews reset local/session storage)?
- Is there a way to persist Supabase sessions across previews?
- Any best practices to avoid logging in every single time a preview is regenerated?
Would really appreciate any insights or workarounds—this is currently a blocker in my workflow.
Thanks in advance!