Authentication
Utlizing and customizing authentication with Supabase
Authentication in sveltepack
Out of the box, sveltepack has traditional email/password authentication for users
Protecting Routes
In an effort to preserve simplicity, client side authentication is used. As a result, route protection will occur on the client side and should be paired with RLS policies to prevent sensitive data from getting into the wrong hands.
With that, there is a handy route protection function in your $lib called protectedRoute
. It can be imported to any page or layout using the following line:
And you can use it by wrapping it in an onMount function within your page or layout.
The function will redirect unauthenticated users to the login page.
Third-Party Authentication Providers
Supabase offers several authentication methods and providers. An in depth guide for each one can be found here.