Jan-Nicklas
Jan-Nicklas
BABetter Auth
Created by Jan-Nicklas on 4/13/2025 in #bug-reports
HaveIBeenPwned creates user anyway
I tried integrating the new haveIBeenPwned() plugin and found out that users are created, even if the password is marked as pwned. {code: "THE_PASSWORD_YOU_ENTERED_HAS_BEEN_COMPROMISED_PLEASE_CHOOSE_A_DIFFERENT_PASSWORD", message: "The password you entered has been compromised. Please choose a different password.", status: 400, statusText: "Bad Request"} 1. code = message? (I think it's good to customize the code in addition to the message for localization purposes) 2. The user is created in the database anyways
17 replies
BABetter Auth
Created by Jan-Nicklas on 3/8/2025 in #help
Passkey on same device?
No description
2 replies
BABetter Auth
Created by Jan-Nicklas on 3/5/2025 in #bug-reports
TwoFactor plugins requires id column in schema?
I'm getting the following error message, when calling authClient.twoFactor.enable:
# SERVER_ERROR: [BetterAuthError: The field "id" does not exist in the "twoFactor" schema. Please update your drizzle schema or re-generate using "npx @better-auth/cli generate".] {
cause: undefined
}
# SERVER_ERROR: [BetterAuthError: The field "id" does not exist in the "twoFactor" schema. Please update your drizzle schema or re-generate using "npx @better-auth/cli generate".] {
cause: undefined
}
AFAIK, the twoFactor table doesn't need an ID column and the documentation doesn't mention one. Config:
database: drizzleAdapter(db, {
provider: 'pg', // or "mysql", "sqlite"
schema: {
user: users,
session: sessions,
account: accounts,
verification: verifications,
twoFactor: twoFactors
}
}),

export const twoFactors = pgTable('twoFactor', {
userId: text()
.primaryKey()
.references(() => users.id, { onDelete: 'cascade' }),
secret: text().notNull(),
backupCodes: text().notNull()
});
database: drizzleAdapter(db, {
provider: 'pg', // or "mysql", "sqlite"
schema: {
user: users,
session: sessions,
account: accounts,
verification: verifications,
twoFactor: twoFactors
}
}),

export const twoFactors = pgTable('twoFactor', {
userId: text()
.primaryKey()
.references(() => users.id, { onDelete: 'cascade' }),
secret: text().notNull(),
backupCodes: text().notNull()
});
7 replies
BABetter Auth
Created by Jan-Nicklas on 2/21/2025 in #bug-reports
Documentation is missing userId
The documentation for the Two-Factor database schema is missing the userId in the twoFactor table: https://www.better-auth.com/docs/plugins/2fa#schema
2 replies