@user-hub/auth 0.1.0 → 0.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/README.md +5 -2
- package/package.json +1 -1
- package/skills/user-hub-auth/SKILL.md +9 -5
package/README.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# @user-hub/auth
|
|
2
2
|
|
|
3
|
-
> [!NOTE]
|
|
4
3
|
> **Private beta.** This package needs a User Hub, which is not public yet. Until then it is only useful to teams already running one.
|
|
5
4
|
|
|
6
5
|
Sign people into your app with their User Hub badge. People scan a printed QR code and arrive in your app already signed in. You get `{ id, name, team, role }` and build no sign-in screens, passwords or sessions.
|
|
@@ -22,7 +21,11 @@ Works with Convex apps, React frontends and any server that can check a token.
|
|
|
22
21
|
bun add @user-hub/auth
|
|
23
22
|
```
|
|
24
23
|
|
|
25
|
-
Using a coding agent? The package ships an agent skill
|
|
24
|
+
Using a coding agent? The package ships an agent skill. Add it to your agents with:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
bunx skills experimental_sync
|
|
28
|
+
```
|
|
26
29
|
|
|
27
30
|
### 2. Register your app with the hub
|
|
28
31
|
|
package/package.json
CHANGED
|
@@ -7,9 +7,13 @@ description: Sign people into an app from their User Hub badge. Use when an app
|
|
|
7
7
|
|
|
8
8
|
People at a workshop scan a printed QR badge. The hub sends them to whichever app is live, signed in, with a token in the URL fragment (`#token=…`) that only that app accepts. This package turns that token into a signed-in person. The app keeps its own data, keyed on the person's hub id.
|
|
9
9
|
|
|
10
|
-
## The hub
|
|
10
|
+
## The hub's URL
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
The hub has one address, for example `https://hub.example.com`. The human gives it to you; you need it in three places, all with the same value:
|
|
13
|
+
|
|
14
|
+
- `HUB_URL` in the app's `.env` or `.env.local`: read by `hub-user register` (**Register the app**). The human puts it there with the admin password.
|
|
15
|
+
- `HUB_ISSUER` on the app's Convex deployment: `hub-user register` prints it for you (**Set the two values**).
|
|
16
|
+
- `VITE_HUB_URL` in the app's frontend env: lets the dev server send you to the hub to sign in (**Wire it up**).
|
|
13
17
|
|
|
14
18
|
## Before you start: ask the human
|
|
15
19
|
|
|
@@ -31,10 +35,10 @@ You need four things. Ask for them; never guess.
|
|
|
31
35
|
bun add @user-hub/auth
|
|
32
36
|
```
|
|
33
37
|
|
|
34
|
-
2. **Register the app** from the app's repo root, with the
|
|
38
|
+
2. **Register the app** from the app's repo root, with `HUB_URL` and the password supplied the way the human chose in question 3 above:
|
|
35
39
|
|
|
36
40
|
```sh
|
|
37
|
-
bunx hub-user register --name "
|
|
41
|
+
bunx hub-user register --name "<app name>" --prod https://app.example.com --dev http://localhost:3000
|
|
38
42
|
```
|
|
39
43
|
|
|
40
44
|
Leave out `--prod` if the app is not deployed yet. Running it again with the same `--name` updates the URLs; a URL left out keeps the registered one. If it fails with "set HUB_URL", "set HUB_ADMIN_PASSWORD" or a wrong password, stop and ask the human; do not work around it.
|
|
@@ -45,7 +49,7 @@ You need four things. Ask for them; never guess.
|
|
|
45
49
|
- Convex: `bunx convex env set HUB_ISSUER '…'` and `bunx convex env set HUB_JWKS '…'` (on every deployment the app uses).
|
|
46
50
|
- Other servers: their environment, same names.
|
|
47
51
|
|
|
48
|
-
4. **Wire it up** with the key from
|
|
52
|
+
4. **Wire it up** with the key from **Register the app**.
|
|
49
53
|
|
|
50
54
|
Convex, `convex/auth.config.ts`:
|
|
51
55
|
|