supabase / supabase-js

An isomorphic Javascript client for Supabase. Query your Supabase database, subscribe to realtime events, upload and download files, browse typescript examples, invoke postgres functions via rpc, invoke supabase edge functions, query pgvector.
https://supabase.com
MIT License
3.23k stars 262 forks source link

SvelteKit authentication with static adapter #882

Open notramo opened 1 year ago

notramo commented 1 year ago

The client-side auth flow requires writing server-side hooks according to the docs, but it's not available with the static adapter. Is it possible to somehow solve authentication in a static site?

petrsiegl commented 1 year ago

You would do the same as for pure Svelte: https://supabase.com/docs/guides/getting-started/tutorials/with-svelte

notramo commented 1 year ago

Could you explain how? As I previously mentioned, the static adapter does not support server-side hooks.

petrsiegl commented 1 year ago

The tutorial doesn't use any server-side hooks, as it's tutorial for svelte therefore no hooks exists. Just go from top to bottom of the linked tutorial and you will have working auth flow.

notramo commented 11 months ago

Sorry for the confusion, I haven't notice there are separate pages for pure Svelte and SvelteKit. However, SvelteKit does not use window.fetch but event.fetch, so it's not compatible with the SvelteKit tutorial. #889