Recommended approach for Auth Guard for svelte-kit apps #3911
-
What is the recommended approach for implementing a role-based guard for svelte-kit based applications? Until Adding a load function in the |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 5 replies
-
You can implement an auth guard with a single load function by making it reactive. Take a look at this paragraph from the docs. If you want a visual example, here's a youtube video showing the process. |
Beta Was this translation helpful? Give feedback.
-
I was having the same problem understanding how to effectively protect all routes under a specific path, until I re-read this part of the docs from the link provided above: |
Beta Was this translation helpful? Give feedback.
-
Check this out sveltekit-route-guard |
Beta Was this translation helpful? Give feedback.
-
I've written a lightweight library for myself to handle protected route guards with ease. |
Beta Was this translation helpful? Give feedback.
-
I have implemented something that works well with supabase auth. Planning to extend it to support others like firebase, auth0, etc. |
Beta Was this translation helpful? Give feedback.
You can implement an auth guard with a single load function by making it reactive. Take a look at this paragraph from the docs.
If you want a visual example, here's a youtube video showing the process.