@mastra/auth-better-auth 1.1.2-alpha.2 → 1.1.2
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/CHANGELOG.md +36 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# @mastra/auth-better-auth
|
|
2
2
|
|
|
3
|
+
## 1.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Added a deferred instance mode and organization management to MastraAuthBetterAuth so it can be passed directly to a server host without a wrapper adapter. The provider can now be constructed with just a secret and will build its Better Auth instance (including running migrations) against the host database during init. It also bootstraps a personal organization for new users (ensureOrganization), checks organization admin roles (isOrganizationAdmin), and exposes the Better Auth HTTP handler (handleAuthRequest) so hosts can mount it under /auth/api/*. ([#19765](https://github.com/mastra-ai/mastra/pull/19765))
|
|
8
|
+
|
|
9
|
+
**Before**
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { betterAuth } from 'better-auth';
|
|
13
|
+
import { MastraAuthBetterAuth } from '@mastra/auth-better-auth';
|
|
14
|
+
|
|
15
|
+
const auth = new MastraAuthBetterAuth({ auth: betterAuth({/* ... */}) });
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
**After** (bring-your-own instance still works)
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { MastraAuthBetterAuth } from '@mastra/auth-better-auth';
|
|
22
|
+
|
|
23
|
+
const auth = new MastraAuthBetterAuth({ secret: process.env.BETTER_AUTH_SECRET! });
|
|
24
|
+
// host calls auth.init({ database, publicUrl, allowedOrigins }) during startup
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- Updated the minimum better-auth version to 1.6.13 to pull in the fix for a stored cross-site scripting vulnerability in better-auth's OIDC provider and MCP plugins (GHSA-86j7-9j95-vpqj). ([#19584](https://github.com/mastra-ai/mastra/pull/19584))
|
|
28
|
+
|
|
29
|
+
- Fixed Better Auth bearer token authentication and implemented user lookup in `@mastra/auth-better-auth` (fixes [#19110](https://github.com/mastra-ai/mastra/issues/19110)). ([#19629](https://github.com/mastra-ai/mastra/pull/19629))
|
|
30
|
+
|
|
31
|
+
**Bearer tokens now work after credentials sign-in**
|
|
32
|
+
|
|
33
|
+
`signIn`/`signUp` return Better Auth's raw session token, but Better Auth only accepts _signed_ session cookies. Sending that token as `Authorization: Bearer <token>` previously always failed authentication. The provider now signs unsigned tokens with the Better Auth secret before verifying the session — matching the semantics of Better Auth's bearer plugin. The session cookie name is also resolved from the Better Auth instance, so secure-cookie setups (`__Secure-` prefix) work too.
|
|
34
|
+
|
|
35
|
+
**`getUser()` and `getUsers()` are now implemented**
|
|
36
|
+
|
|
37
|
+
Previously `getUser()` was a stub that always returned `null`, breaking Studio user lookup and author enrichment. It now resolves users by ID through Better Auth's internal database adapter, and `getUsers()` supports batch lookups.
|
|
38
|
+
|
|
3
39
|
## 1.1.2-alpha.2
|
|
4
40
|
|
|
5
41
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/auth-better-auth",
|
|
3
|
-
"version": "1.1.2
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Mastra Better Auth integration - self-hosted authentication",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"tsup": "^8.5.1",
|
|
35
35
|
"typescript": "^6.0.3",
|
|
36
36
|
"vitest": "4.1.10",
|
|
37
|
-
"@internal/auth": "0.0.
|
|
38
|
-
"@internal/
|
|
39
|
-
"@internal/
|
|
37
|
+
"@internal/auth": "0.0.7",
|
|
38
|
+
"@internal/lint": "0.0.115",
|
|
39
|
+
"@internal/types-builder": "0.0.90"
|
|
40
40
|
},
|
|
41
41
|
"files": [
|
|
42
42
|
"dist",
|