Open navigation menu

SvelteKit Auth Flow with OAuth

A complete auth flow using SvelteKit, Lucia Auth, and OAuth 2.0 with GitHub and Google providers, session management, and protected route hooks.

  • SvelteKit
  • Lucia
  • OAuth
  • TypeScript

Highlights

  • Lucia Auth session management with database-backed sessions and automatic expiry
  • OAuth 2.0 multi-provider flow with GitHub and Google for social login
  • SvelteKit hooks for protected routes with redirect-back-to-original-URL
  • CSRF protection with origin header validation on all mutation requests

Repository

View on GitHub ↗