Sveltekit Supabase Oauth screenshot

Sveltekit Supabase Oauth

Author Avatar Theme by J4w8n
Updated: 16 Nov 2023
23 Stars

Supabase OAuth, with SvelteKit

Categories

Overview:

This product analysis examines a demo of Supabase OAuth with SvelteKit. It is built using SvelteKit version 1.0 and Supabase version 2.0.0. The demo showcases various features, including server-side Supabase client authentication, auth guards for server page requests and client navigation, and a secure version of the SvelteKit $session store. The analysis also includes a setup guide for cloning the repository and configuring the necessary environment variables.

Features:

  • Server-side Supabase client authentication in hooks.server.js: This feature enables server-side authentication using Supabase client in the hooks.server.js file.
  • Auth guards for server page requests and client navigation: The demo provides auth guards to protect server page requests with the +layout.server.js file, and client navigation with +page.server.js files in subdirectories.
  • Secure version of the SvelteKit $session store: The demo replaces the old SvelteKit $session store with a secure version, enhancing the security of session management.

Installation:

To install the theme, follow these steps:

  1. Clone the repository.

  2. Create a .env file in the root of your project with the following variables:

    • PUBLIC_BASE_URL (e.g., http://localhost)
    • PUBLIC_SUPABASE_URL
    • PUBLIC_SUPABASE_ANON_KEY
  3. Provide the relevant data for the environment variables.

Summary:

This product analysis explores a demo of Supabase OAuth with SvelteKit, highlighting its key features and providing a guide for installation. The demo leverages server-side Supabase client authentication, auth guards for server page requests and client navigation, and a secure version of the SvelteKit $session store.