Skip to content

PrismaUserStoreOptions

U extends AuthUser

readonly optional createData?: (input) => Record<string, unknown>

Extra values for required columns of a new user (a tenant, a display name).

NormalizedEmail

Record<string, unknown>


readonly delegate: PrismaUserDelegate

prisma.user, or whichever model holds your accounts.


readonly optional fields?: UserFields


readonly optional logger?: Pick<Logger, "warn">

Told once, as a warning, when Prisma refuses the skipped insert and the store switches to create for good (SQLite, a nested createData). Pass the logger you give createAuth. Default: silent.


readonly optional select?: Readonly<Record<string, true>>

Extra columns to read for your user type.


readonly optional toUser?: (row) => U

Maps a row (mapped fields plus select) to your user type. Default: the four auth fields.

Record<string, unknown>

U


readonly optional writeWhere?: Readonly<Record<string, unknown>>

A Prisma where that a row must also match to take a credential write: a new password hash (setPasswordHash), a verified address (markEmailVerified) and an email change (changeEmail). For an app that closes accounts on a column of its own, such as { closedAt: null }: the condition is part of the same UPDATE, so an account closed after your beforePasswordReset hook ran still refuses the new password, and the flow answers it as a refused write (invalid_token from a reset).

Reads are left alone: lookups and login still find the row, so refuse a closed account at sign-in in your own hooks. An email revert (the changeEmail that also clears the password) is not guarded: it only takes access away, so a closed account can still be reverted by its owner. A rehash after login is guarded like any password write, so a closed account keeps its old hash. Combined with the store’s own conditions through AND, so it can narrow the write but never widen it.

Checked, copied and frozen when the store is built (see write-guard.ts for what is refused: an empty object or an undefined anywhere inside, an empty AND or NOT list), and copied again for each write. A column name Prisma does not know is not caught there: the first guarded write throws, with Prisma’s message (which prints the new hash) left out. Default none.