@clivly/auth-better-auth 0.7.2 → 0.7.3
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 +5 -21
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,35 +1,19 @@
|
|
|
1
1
|
# @clivly/auth-better-auth
|
|
2
2
|
|
|
3
|
-
better-auth implementation of Clivly's `ClivlyAuthAdapter`.
|
|
4
|
-
current end-user through `auth.api.getSession({ headers })` on each request.
|
|
3
|
+
[better-auth](https://better-auth.com) implementation of Clivly's `ClivlyAuthAdapter`. Resolves a CRM end-user's identity from the host app's better-auth session via `auth.api.getSession`.
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
npm install @clivly/auth-better-auth better-auth
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
This adapter is a Tier 2 surface in
|
|
13
|
-
[STABILITY.md](https://github.com/amani-joseph/clivly.com/blob/master/STABILITY.md).
|
|
14
|
-
|
|
15
|
-
## Usage
|
|
5
|
+
Zero runtime dependencies — you pass your own `betterAuth({...})` instance, so there's no `better-auth` version to keep in lockstep.
|
|
16
6
|
|
|
17
7
|
```ts
|
|
18
8
|
import { createBetterAuthAdapter } from "@clivly/auth-better-auth";
|
|
19
|
-
import { auth } from "./auth";
|
|
9
|
+
import { auth } from "./auth"; // your betterAuth({ ... }) instance
|
|
20
10
|
|
|
21
11
|
const authAdapter = createBetterAuthAdapter({ auth });
|
|
22
12
|
|
|
23
|
-
const user = await authAdapter.getUser(request);
|
|
24
|
-
// { id, email, name } | null
|
|
13
|
+
const user = await authAdapter.getUser(request); // { id, email, name } | null
|
|
25
14
|
```
|
|
26
15
|
|
|
27
|
-
|
|
28
|
-
`betterAuth({...})` instance in.
|
|
29
|
-
|
|
30
|
-
Returns `null` when there is no session, or when the session user cannot be
|
|
31
|
-
mapped to a Clivly user. The adapter only answers identity; CRM authorization
|
|
32
|
-
still lives in Clivly's separate `crm_members` layer.
|
|
16
|
+
Returns `null` when there's no session or the session user has no email (Clivly requires one). The adapter answers "who is this person?" only — CRM authorization lives in Clivly's separate `crm_members` layer.
|
|
33
17
|
|
|
34
18
|
## License
|
|
35
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clivly/auth-better-auth",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "better-auth implementation of Clivly's ClivlyAuthAdapter.",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@clivly/core": "0.7.
|
|
28
|
+
"@clivly/core": "0.7.3"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"tsdown": "^0.22.14",
|