© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago
xenfasa

sveltekit-email-password auth example session fails when running vite as non-localhost

When I run the auth helper example called sveltekit-email-password it works fine when accessing vite as localhost or 127.0.0.1.

But when I add "dev": "vite dev --port 3001 --host 0.0.0.0 " to package.json so that vite binds to a real IP address, the example runs but on each sussessful login the session is reset to null. This only happens when accessing dev site from an IP address.

Supabase backend shows authenticated correctly. No errors on the svelte front end. The problem happens when authentication is sussesful and sveltekit redirects to /dashboard. Could invalidate be erasing the session when accessing from an IP address?

Maybe the layout It seems the root +layout.svelte is removing the session with
supabaseClient.auth.onAuthStateChange(() => {invalidate('supabase:auth');}

Why would http://localhost:3000 work and http://real_ip_address:3000 for successful logins not work?

Am I missing something obvious or is there a bug in the auth-helper example?

Thanks for any idea. This has been driving me crazy.
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

email & password auth with sveltekit
SupabaseSSupabase / help-and-questions
3y ago
email + password signup in sveltekit?
SupabaseSSupabase / help-and-questions
4y ago
SvelteKit SSR auth example bug?
SupabaseSSupabase / help-and-questions
6mo ago
Sveltekit auth helper example error
SupabaseSSupabase / help-and-questions
4y ago