Lucia
Constructor
function constructor<
_SessionAttributes extends {} = Record<never, never>,
_UserAttributes extends {} = Record<never, never>
>(
adapter: Adapter,
options?: {
sessionExpiresIn?: TimeSpan;
sessionCookie?: {
name?: string;
expires?: boolean;
attributes: {
sameSite?: "lax" | "strict" | "none";
domain?: string;
path?: string;
secure?: boolean;
};
};
getSessionAttributes?: (
databaseSessionAttributes: DatabaseSessionAttributes
) => _SessionAttributes;
getUserAttributes?: (databaseUserAttributes: DatabaseUserAttributes) => _UserAttributes;
}
): this;
Parameters
adapter: Database adapter
options:
sessionExpiresIn: How long a session lasts for inactive users
sessionCookie: Session cookie options
name: Cookie name (default: auth_session)
expires: Set to false for cookies to persist indefinitely (default: true)
attributes: Cookie attributes
sameSite
domain
path
secure
getSessionAttributes(): Transforms database session attributes and the returned object is added to the Session object
getUserAttributes(): Transforms database user attributes and the returned object is added to the User object
Method