@delmaredigital/payload-better-auth 0.6.10 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -4
- package/dist/exports/client.d.ts +9 -1685
- package/dist/exports/client.js +4 -0
- package/dist/generated-types.d.ts +53 -20
- package/dist/scripts/generate-types.js +5 -3
- package/package.json +15 -14
package/README.md
CHANGED
|
@@ -12,7 +12,13 @@ Better Auth adapter and plugins for Payload CMS. Enables seamless integration be
|
|
|
12
12
|
<a href="https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fdelmaredigital%2Fdd-starter&project-name=my-payload-site&build-command=pnpm%20run%20ci&env=PAYLOAD_SECRET,BETTER_AUTH_SECRET&stores=%5B%7B%22type%22%3A%22integration%22%2C%22protocol%22%3A%22storage%22%2C%22productSlug%22%3A%22neon%22%2C%22integrationSlug%22%3A%22neon%22%7D%2C%7B%22type%22%3A%22blob%22%7D%5D"><img src="https://vercel.com/button" alt="Deploy with Vercel" height="32"></a>
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
|
-
> **Upgrading to 0.
|
|
15
|
+
> ⚠️ **Upgrading to 0.7?** This release requires **Better Auth 1.6** and includes several breaking changes:
|
|
16
|
+
>
|
|
17
|
+
> - **Schema migration required** for projects using the `twoFactor` plugin — Better Auth 1.6.2 added a `verified` column to the `twoFactor` table.
|
|
18
|
+
> - **`oidcProvider` → `@better-auth/oauth-provider`** — generated OAuth types now reflect the `oauth-provider` schema. Consumers using `oidcProvider()` at runtime will keep working, but `OauthApplication` / `PluginId` / `ModelKey` type exports have changed shape. Migrating to `@better-auth/oauth-provider` is recommended.
|
|
19
|
+
> - **Client helper type widening** — `createPayloadAuthClient()` and `payloadAuthPlugins` are typed more conservatively to keep `.d.ts` portable. For typed plugin methods (e.g. `client.twoFactor.verifyTotp`), list plugins explicitly in `createAuthClient({ plugins: [...] })` (see [Client-Side Auth](#4-client-side-auth) below).
|
|
20
|
+
>
|
|
21
|
+
> See the [CHANGELOG](./CHANGELOG.md#070---2026-04-21) for full migration instructions.
|
|
16
22
|
|
|
17
23
|
---
|
|
18
24
|
|
|
@@ -30,7 +36,7 @@ For AI-assisted exploration: [DeepWiki](https://deepwiki.com/delmaredigital/payl
|
|
|
30
36
|
pnpm add @delmaredigital/payload-better-auth better-auth
|
|
31
37
|
```
|
|
32
38
|
|
|
33
|
-
**Requirements:** `payload` >= 3.69.0 · `better-auth` >= 1.
|
|
39
|
+
**Requirements:** `payload` >= 3.69.0 · `better-auth` >= 1.6.0 · `next` >= 15.4.8 · `react` >= 19.2.1
|
|
34
40
|
|
|
35
41
|
## Quick Start
|
|
36
42
|
|
|
@@ -138,13 +144,18 @@ export default buildConfig({
|
|
|
138
144
|
// src/lib/auth/client.ts
|
|
139
145
|
'use client'
|
|
140
146
|
|
|
141
|
-
import {
|
|
147
|
+
import { createAuthClient, twoFactorClient } from '@delmaredigital/payload-better-auth/client'
|
|
148
|
+
import { passkeyClient } from '@better-auth/passkey/client'
|
|
142
149
|
|
|
143
|
-
export const authClient =
|
|
150
|
+
export const authClient = createAuthClient({
|
|
151
|
+
plugins: [twoFactorClient(), passkeyClient()],
|
|
152
|
+
})
|
|
144
153
|
|
|
145
154
|
export const { useSession, signIn, signUp, signOut, twoFactor, passkey } = authClient
|
|
146
155
|
```
|
|
147
156
|
|
|
157
|
+
> Listing plugins inline (rather than using `createPayloadAuthClient()` or spreading `payloadAuthPlugins`) ensures `twoFactor` and other plugin methods are typed on the returned client.
|
|
158
|
+
|
|
148
159
|
### 5. Server-Side Session
|
|
149
160
|
|
|
150
161
|
```ts
|