Skip to main content
Better Auth provides a set of methods for managing users beyond authentication. This includes updating user information, changing passwords, deleting users, and managing OAuth account connections. The user table stores authentication data. See the database schema for the full field list. You can extend the user schema with additional fields or use plugins.

Updating users

Update user information

Update a user’s name or image using the updateUser function:

Change email

Email change is disabled by default. Enable it by setting changeEmail.enabled to true and providing a sendVerificationEmail function:
auth.ts
Avoid awaiting the email sending to prevent timing attacks. On serverless platforms, use waitUntil or a similar mechanism to ensure the email is sent.
By default, a verification email is sent to the new email address. The email is only updated after the user verifies it.

Require confirmation from the current email

For added security, require users to approve the change from their current email before the verification link is sent to the new address:
auth.ts

Allow change without verification

If the user’s current email is not verified and you want to allow immediate updates without verification:
auth.ts

Client usage

Change password

Passwords are stored in the account table, not the user table. Use changePassword to update it:

Set password

Users who registered via OAuth do not have a password. Use the server-side setPassword method to add one. For security, this can only be called from the server — we recommend routing users through a forgot-password flow instead.
set-password.ts

Verify password

Verify the current user’s password before sensitive operations. This can only be called from the server.
verify-password.ts
For OAuth users without passwords, consider using email verification or fresh session checks for sensitive operations.

Deleting users

User deletion is disabled by default. Enable it with deleteUser.enabled:
auth.ts
Once enabled, call authClient.deleteUser() to permanently remove a user’s data.

Verification before deletion

For added security, send a verification email before deleting the account. This is especially useful for OAuth users who cannot prove identity with a password.
auth.ts

Authentication requirements

To delete an account, the user must satisfy one of the following:
1

Provide a valid password

2

Have a fresh session

The user must have signed in recently. The freshAge defaults to 1 day.
3

Complete email verification

Required for OAuth users who have no password. Only works when sendDeleteAccountVerification is configured.

Callbacks

Run custom logic before and after user deletion:
auth.ts

Accounts

Each authentication method is a provider. When a user signs in via a provider, an account record is created in the account table. Accounts store provider-returned data such as access tokens, refresh tokens, and scopes.

List user accounts

Token encryption

Better Auth does not encrypt tokens by default — this is intentional, giving you full control over encryption. Use databaseHooks to encrypt tokens before they are saved:
Remember to decrypt tokens whenever you retrieve them from the database.

Account linking

Account linking is enabled by default and lets users connect multiple authentication methods to a single user record. Linking requires the provider to confirm the email as verified. To disable account linking entirely:
auth.ts

Trusted providers (forced linking)

Specify providers that are trusted regardless of email verification status:
auth.ts
Use trusted providers with caution. Forcing account linking without email verification increases the risk of account takeover.

Manually linking social accounts

Signed-in users can link additional social providers:
To allow linking with a different email address than the user’s current one:
auth.ts
To update user information when a new account is linked:
auth.ts

Linking credential-based accounts

For email/password accounts, use the server-side setPassword method or direct users through a forgot-password flow:
set-password.ts

Account unlinking

Unlink a provider from the current user’s account:
If the user has only one account, unlinking is blocked by default to prevent lockout. Override this with allowUnlinkingAll:
auth.ts