supabase-js icon indicating copy to clipboard operation
supabase-js copied to clipboard

SvelteKit authentication with static adapter

Open notramo opened this issue 2 years ago • 4 comments

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?

notramo avatar Oct 17 '23 16:10 notramo

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

petrsiegl avatar Nov 02 '23 11:11 petrsiegl

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

notramo avatar Nov 03 '23 18:11 notramo

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.

petrsiegl avatar Nov 03 '23 18:11 petrsiegl

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

notramo avatar Nov 13 '23 17:11 notramo