Sveltekit-auth-cookies Alternatives
Similar projects and alternatives to sveltekit-auth-cookies
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
NOTE:
The number of mentions on this list indicates mentions on common posts plus user suggested alternatives.
Hence, a higher number means a better sveltekit-auth-cookies alternative or higher similarity.
sveltekit-auth-cookies reviews and mentions
Posts with mentions or reviews of sveltekit-auth-cookies.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2022-09-21.
-
SvelteKit Changes: Session and Cookies
// hook.server.ts import type { Handle } from '@sveltejs/kit'; import { userRepository } from './lib/Redis/dbRepository'; // custom redirect from joy of code `https://github.com/JoysOfCode/sveltekit-auth-cookies/blob/migration/src/hooks.ts` function redirect(location: string, body?: string) { return new Response(body, { status: 303, headers: { location } }); } const unProtectedRoutes: string[] = [ '/', '/login', '/createAdmin', '/features', '/docs', '/deployment' ]; export const handle: Handle = async ({ event, resolve }) => { const session = event.cookies.get('session'); if (!session && !unProtectedRoutes.includes(event.url.pathname)) return redirect('/login', 'No authenticated user.'); const currentUser = await userRepository.fetch(session as string); if (currentUser) { event.locals.user = { isAuthenticated: true, name: currentUser.name, email: currentUser.email, type: currentUser.user_type, active: currentUser.active, phone: currentUser.phone }; } else { if (!unProtectedRoutes.includes(event.url.pathname)) return redirect('/', 'Not a valid user'); } return resolve(event); };
Stats
Basic sveltekit-auth-cookies repo stats
1
67
3.9
12 months ago
The primary programming language of sveltekit-auth-cookies is TypeScript.
Sponsored
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com