Quickstart
Installation
npm install authoraInitialize Authora
import { Authora } from "authora";
const adapter = new BetterSQLite3Adapter(db); // your adapter
// for sessions
export const authora = new Authora(adapter, {
sessionCookie: {
attributes: {
// set to `true` when using HTTPS
secure: process.env.NODE_ENV === "production"
}
}
});
// for jwt
export const authora = new Authora({
useJWT: true,
jwtSecret: process.env.JWT_SECRET,
// the jwt option can be overide later
jwtOptions: {
signOptions: {
expiresIn: '1h'
}
}
});
// IMPORTANT!
declare module "authora" {
interface Register {
Authora: typeof authora;
}
}Polyfill
Last updated