twoFactorTable
Is it still possible to set
twoFactorTable? I'm not able to find the function under the server config but is see the others:
11 Replies
Hey can you elaborate? I'm not too sure I understand your question
the database table for the two factor plugin, i want to change the name, however the option as per the documentation to change it is unavailable
Server twoFactorTable: The name of the table that stores the two factor authentication data. Default: twoFactor.https://www.better-auth.com/docs/plugins/2fa
Two-Factor Authentication (2FA) | Better Auth
Enhance your app's security with two-factor authentication.
using the command
npx @better-auth/cli generate actually generated table named "two_factor" in the schema, not twoFactorHaving the same issue. Did you manage to figure this out?
I defined the schema for my
TwoFactor table via the plugin's schema option. But still having issues with a bunch of API calls to the /two-factor endpoint.Are you using Drizzle?
yes
our schema gen will generate table names lowercased, but technically speaking the expected table name is
twoFactor. When using the drizzle adapter, we look at your drizzle schema rather than relying on expected table names
So using the drizzle schema gen variable name will be twoFactor but the name for the db will be two_factori wanted to change the db table name
you should be able to change the drizzle schema directly without chaning anything to do with better-auth
Just change this part tho

Thank you. 👍. My specific issue was that
twoFactorEnabled in my user table is named, two_factor_enabled. I managed to resolve my issue by defining this change in the twoFactor plugin's schema configuration option.