This is my auth.ts file located in utils folder (I use nuxt 3)
auth.ts
import { Lucia } from "lucia"
import { D1Adapter } from "@lucia-auth/adapter-sqlite"
export function initializeLucia(D1: D1Database) {
const adapter = new D1Adapter(D1, {
user: "users",
session: "session",
})
return new Lucia(adapter, {
sessionCookie: {
attributes: {
secure: !import.meta.dev,
},
},
getUserAttributes: (attributes) => {
return {
firstname: attributes.first_name,
lastname: attributes.last_name,
email: attributes.email,
username: attributes.username,
country: attributes.country,
gender: attributes.gender,
date_of_birth: attributes.date_of_birth,
selectedPhoneCode: attributes.selectedPhoneCode,
phone: attributes.phone,
}
},
})
}
declare module "lucia" {
interface Register {
Lucia: ReturnType<typeof initializeLucia>
DatabaseUserAttributes: DatabaseUserAttributes
}
}
interface DatabaseUserAttributes {
first_name: string
last_name: string
email: string
username: string
country: string
gender: string
date_of_birth: string
selectedPhoneCode: string
phone: string
}
I need to get user attribute called email_verified which stores string data. The problem is that the current attributes are picking data from table called users but I need to pick data as well from table called account_verification which has row called email_verified which I need.