- Utilities that help when adding Userfront auth to a (Svelte) project:
RequireLogin
: auth guard that redirects/shows error when authorization requirements not met.handleMissingAuthGuard
: optional SvelteKit handle hook that prevents access of protected routes if they are missing an auth guard.UserfrontApi
: class that simplifies calls to the Userfront API.userfrontCookieToTokens()
: parse userfront cookie into tokensverifyToken()
: verify a JWT token; extract payload
- Step-by-step tutorial: how to use UserFront + Svelte(Kit):
- Live demo of results: https://userfront-svelte-leftium.vercel.app
npm install -D userfront-svelte
For usage, see tutorial below.