mirror of
https://github.com/better-auth/better-auth.git
synced 2026-05-25 00:22:43 -05:00
docs: add docs for one time token client plugin (#4220)
This commit is contained in:
committed by
Alex Yang
parent
cfde604665
commit
0f5c912b5e
@@ -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({
|
||||
}
|
||||
}
|
||||
})
|
||||
```
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user