takoyaro / lucia-auth

A simple authentication library

Home Page:https://lucia-auth.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lucia

Join the Discord server!

Thank you for 300 GitHub stars, and counting!

Lucia is a simple yet flexible user and session management library that provides an abstraction layer between your app and your database. It's bare-bones by design, keeping everything easy to use and understand. Lucia is the authentication solution that works with you and your app. Get started by reading the introduction page.

At its core, it makes managing users and sessions easy, and it doesn’t attempt to do anything more than that. It’s not an out-of-the-box library like NextAuth, nor an auth platform like Firebase, and that is a super important distinction. You will need to use your own database and strategies like OAuth and magic links have to be made by yourself. However, once you understand the basics of Lucia and authentication, it allows you to fully control and customize your authentication.

Working with Lucia looks something like this. In the code below, you're creating a new user with a email/password method, creating a new session, and creating a cookie that you can set it to the user.

const user = await auth.createUser("email", email, {
	password
});
const session = await auth.createSession(user.userId);
const sessionCookie = auth.createSessionCookie(session)

Documentation

Documentation

Changelog

Installation

npm i lucia-auth
pnpm add lucia-auth
yarn add lucia-auth

Contributing

CONTRIBUTING.md

About

A simple authentication library

https://lucia-auth.vercel.app

License:MIT License


Languages

Language:TypeScript 88.7%Language:Astro 5.1%Language:JavaScript 2.7%Language:Svelte 2.7%Language:CSS 0.6%Language:HTML 0.2%