@clivly/auth-workos 0.7.2 → 0.7.4

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.
Files changed (2) hide show
  1. package/README.md +57 -15
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,37 +1,79 @@
1
1
  # @clivly/auth-workos
2
2
 
3
- WorkOS implementation of Clivly's `ClivlyAuthAdapter`. It reads the host app's
4
- AuthKit session cookie, authenticates it through WorkOS, and maps the user into
5
- Clivly's auth shape.
3
+ [WorkOS](https://workos.com) implementation of Clivly's `ClivlyAuthAdapter`.
4
+ Unseals the host app's AuthKit session cookie to resolve a CRM end-user's
5
+ identity.
6
6
 
7
- ## Install
7
+ It answers **"who is this person?"** only. CRM authorization lives separately in
8
+ Clivly's `crm_members` layer.
9
+
10
+ > **Preview-quality surface.** The user mapper, cookie reader, and session
11
+ > resolution are unit-tested; broader host-app compatibility coverage is still
12
+ > growing.
13
+
14
+ > **Optional.** You do not need an auth adapter to sync data into Clivly. Only
15
+ > reach for one when a Clivly surface must resolve which of *your* users is
16
+ > making a request.
17
+
18
+ ## Prerequisites
19
+
20
+ | Requirement | Version / note |
21
+ | --- | --- |
22
+ | Node.js | **≥ 22** |
23
+ | `@workos-inc/node` | **≥ 7** — a peer dependency you install yourself |
24
+ | WorkOS credentials | API key, client ID, and the AuthKit cookie password |
25
+
26
+ ## Installation
27
+
28
+ Two equivalent import paths — pick whichever matches how you installed Clivly:
8
29
 
9
30
  ```bash
31
+ # If you already installed `clivly` (recommended — this is what `clivly init` does)
32
+ npm install @workos-inc/node
33
+ # → import from "clivly/auth/workos"
34
+
35
+ # Or standalone
10
36
  npm install @clivly/auth-workos @workos-inc/node
37
+ # → import from "@clivly/auth-workos"
11
38
  ```
12
39
 
13
- This adapter is a Tier 2 surface in
14
- [STABILITY.md](https://github.com/amani-joseph/clivly.com/blob/master/STABILITY.md).
15
-
16
- ## Usage
40
+ ## Quick start
17
41
 
18
42
  ```ts
19
- import { createWorkOSAuthAdapter } from "@clivly/auth-workos";
43
+ import { createWorkOSAuthAdapter } from "clivly/auth/workos";
20
44
 
21
45
  const authAdapter = createWorkOSAuthAdapter({
22
46
  apiKey: process.env.WORKOS_API_KEY!,
23
47
  clientId: process.env.WORKOS_CLIENT_ID!,
24
48
  cookiePassword: process.env.WORKOS_COOKIE_PASSWORD!,
25
- // optional:
26
- // cookieName: "wos-session",
27
49
  });
28
50
 
29
- const user = await authAdapter.getUser(request);
30
- // { id, email, name } | null
51
+ const user = await authAdapter.getUser(request); // { id, email, name } | null
31
52
  ```
32
53
 
33
- Returns `null` when there is no session cookie or the WorkOS session does not
34
- authenticate.
54
+ ## Options
55
+
56
+ | Option | Type | Required | Notes |
57
+ | --- | --- | --- | --- |
58
+ | `apiKey` | `string` | Yes | WorkOS API key (`sk_…`) |
59
+ | `clientId` | `string` | Yes | WorkOS client ID (`client_…`) |
60
+ | `cookiePassword` | `string` | Yes | Password used to unseal the AuthKit session cookie |
61
+ | `cookieName` | `string` | No | Session cookie name. Defaults to `wos-session` |
62
+
63
+ ## Behaviour
64
+
65
+ - Reads the sealed AuthKit session cookie from the incoming request and unseals
66
+ it with `cookiePassword`.
67
+ - Returns `null` when the cookie is absent, cannot be unsealed, or the session
68
+ user has no email address (Clivly requires one).
69
+ - `workosUserToClivlyUser` is exported separately if you already hold a WorkOS
70
+ user object and only need the mapping.
71
+
72
+ ## Related documentation
73
+
74
+ - **[Connecting to Clivly Cloud](https://github.com/amani-joseph/clivly.com/blob/master/docs/guides/connecting-to-clivly-cloud.md#auth-adapters-optional)** — where auth adapters fit in the setup
75
+ - [`@clivly/core` README](https://github.com/amani-joseph/clivly.com/blob/master/packages/core/README.md) — the `ClivlyAuthAdapter` contract
76
+ - [`clivly` CLI README](https://github.com/amani-joseph/clivly.com/blob/master/packages/cli/README.md)
35
77
 
36
78
  ## License
37
79
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clivly/auth-workos",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "WorkOS implementation of Clivly's ClivlyAuthAdapter.",
@@ -25,7 +25,7 @@
25
25
  "access": "public"
26
26
  },
27
27
  "dependencies": {
28
- "@clivly/core": "0.7.2"
28
+ "@clivly/core": "0.7.4"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "@workos-inc/node": ">=7"