This commit fixes the persistent login/redirect loop issue and implements
a robust authentication system for the Docker/localhost environment.
Key Changes:
- Environment-aware cookie configuration in supabase-ssr.ts
- New AuthLoader component to prevent content flashing during auth checks
- Cleaned up login page client-side auth logic to prevent redirect loops
- Updated dashboard to use AuthLoader for smooth authentication experience
Technical Details:
- Cookies now use environment-appropriate security settings
- Server-side auth verification eliminates client-side timing issues
- Loading states provide better UX during auth transitions
- Unified authentication pattern across all protected pages
Fixes:
- Dashboard no longer flashes before auth redirect
- Login page loads cleanly without auth checking loops
- Cookie configuration works correctly in Docker localhost
- No more redirect loops between login and dashboard pages
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Client-side improvements (supabase.ts):
- Set detectSessionInUrl: false to prevent SSR redirect loops
- Add explicit cookieOptions with Docker-friendly settings
- Configure secure: false for localhost non-HTTPS
- Set sameSite: 'lax' for proper navigation cookie handling
Server-side improvements (supabase-ssr.ts):
- Add comprehensive default cookie options
- Ensure consistent cookie configuration across all server clients
- Set maxAge: 7 days for proper session persistence
- Maintain security with httpOnly: true
These changes address session persistence issues in Docker containers
and should resolve Stripe setup redirect loops for existing users.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Set secure: false for localhost (non-HTTPS) environment
- Configure sameSite: 'lax' to allow cookie transmission
- Ensure path: '/' for site-wide cookie access
- Maintain httpOnly: true for security
This should resolve session persistence issues in Docker containers.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add null checks for cookies object in Supabase SSR client
- Fix auth test page to use Astro.cookies instead of Astro.request
- Prevent "Cannot read properties of undefined" errors in cookie handling
- Ensure proper unified auth usage pattern in test pages
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>