Plugins

Reverify

Prompt the user to re-verify their identity by providing their password for revalidation.

VersionDownloadsLicense

The purpose of this plugin is to allow the user to re-verify their identity without modifying their current session. An example use case is before deleting an API key, you would want to re-verify the user's identity to ensure they are the one deleting the key.

This plugin is not for the purpose of refreshing a session, if you want to refresh a session you can use any of the sign-in related methods.

1. Install the plugin

npm install @better-auth-kit/reverify

2. Initialize the plugin

auth.ts
import { reverify } from "@better-auth-kit/reverify";
 
export const auth = betterAuth({
  plugins: [reverify()],
});
auth-client.ts
import { reverifyClient } from "@better-auth-kit/reverify/client";
 
export const authClient = createAuthClient({
  plugins: [reverifyClient()],
});

3. Use the plugin

const { data } = await client.reverify.password({
  password: "some-password",
});
 
const isValid = data?.valid;

On this page