sk-auth
- Authentication library designed for SvelteKit with built-in OAuth providers and extensive customization options.
- Supports Typescript natively with first-class type definitions.
- Enables easy integration of authentication flows (OAuth, SAML SSO, credential logins) through a provider-based system.
Key Features
- OAuth2 Support: Comes with a pre-built
OAuth2Providerclass for standardized OAuth2 flows, handling authorization redirects, token retrieval, and profile fetching. - Session Management: Augments SvelteKit's session handling to include user data via
getSession. - Callbacks: Provides customizable hooks (
signIn,jwt,session,redirect) for fine-grained control over authentication behavior. - Unopinionated Design: Allows custom provider implementations by extending the base
Providerclass.
Target Audience
- Developers building SvelteKit applications requiring authentication.
- Projects needing OAuth2 or custom auth providers without restrictive defaults.
Example Use Case
const appAuth = new SvelteKitAuth({
providers: [new GoogleOAuthProvider({ /* config */ })],
jwtSecret: "your-secret-key",
});
For advanced use, developers can create custom providers or extend existing ones.
Resources
Inspired by NextAuth.js but tailored for SvelteKit's flexibility.
sveltesveltejssveltekitauthoauth
Featured Stories
No featured articles.