web / lib/utils/auth-helpers
lib/utils/auth-helpers
Shared authentication helper functions for account API routes.
Functions
verifyPassword()
verifyPassword(
payload,user,password):Promise<void>
Verify a user’s password by attempting a login. Throws an error with a descriptive message on failure.
Parameters
payload
BasePayload
user
User
password
string
Returns
Promise<void>
verifyPasswordWithAudit()
verifyPasswordWithAudit(
payload,user,password,clientId,context,errorMessage?):Promise<Response|null>
Verify a user’s password and log a failed attempt to the audit log. Returns null on success, or an unauthorized response on failure.
Parameters
payload
BasePayload
user
User
password
string
clientId
string
context
string
errorMessage?
string = "Password is incorrect"
Custom error message for the 401 response (default: “Password is incorrect”)
Returns
Promise<Response | null>
Last updated on