GitHub - pilcrowOnPaper/lucia: Authentication, simple and clean
source link: https://github.com/pilcrowOnPaper/lucia
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Lucia
Lucia is a simple and 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. Get started by reading the introduction page.
Code sample
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({
primaryKey: {
providerId: "email",
providerUserId: email,
password
},
attributes: {
email,
username
}
});
const session = await auth.createSession(user.userId);
const sessionCookie = auth.createSessionCookie(session);
Resources
Installation
npm i lucia-auth
pnpm add lucia-auth
yarn add lucia-auth
Attributions
This project would not have been possible without our contributors, thank you!
Logo by @dawidmachon, licensed under CC BY-NC-SA 4.0.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK