docs: add docs for one time token client plugin (#4220)

This commit is contained in:
Rodrigo Menezes
2025-08-25 20:47:02 -04:00
committed by Alex Yang
parent cfde604665
commit 0f5c912b5e

View File

@@ -7,17 +7,42 @@ The One-Time Token (OTT) plugin provides functionality to generate and verify se
## Installation
```ts title="auth.ts"
import { betterAuth } from "better-auth";
import { oneTimeToken } from "better-auth/plugins/one-time-token";
<Steps>
<Step>
### Add the plugin to your auth config
export const auth = betterAuth({
plugins: [
oneTimeToken()
]
// ... other auth config
});
```
To use the One-Time Token plugin, add it to your auth config.
```ts title="auth.ts"
import { betterAuth } from "better-auth";
import { oneTimeToken } from "better-auth/plugins/one-time-token";
export const auth = betterAuth({
plugins: [
oneTimeToken()
]
// ... other auth config
});
```
</Step>
<Step>
### Add the client plugin
Next, include the one-time-token client plugin in your authentication client instance.
```ts title="auth-client.ts"
import { createAuthClient } from "better-auth/client"
import { oneTimeTokenClient } from "better-auth/client/plugins"
export const authClient = createAuthClient({
plugins: [
oneTimeTokenClient()
]
})
```
</Step>
</Steps>
## Usage
@@ -100,4 +125,4 @@ oneTimeToken({
}
}
})
```
```