@user-hub/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
CHANGED
|
@@ -49,7 +49,7 @@ bunx user-hub events list
|
|
|
49
49
|
bunx user-hub apps register --event spring-workshop --name "Your App" --new --prod https://your-app.com --dev http://localhost:3000
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
`login` saves `HUB_URL` and `HUB_API_KEY` to the folder's `.env.local` (keep it gitignored). A hub runs many **events** (workshops), and an app belongs to one. `apps register` prints your **app key** (made from the event's slug and the name) and the values to set. Not deployed yet? Leave out `--prod`; add it later
|
|
52
|
+
`login` saves `HUB_URL` and `HUB_API_KEY` to the folder's `.env.local` (keep it gitignored). A hub runs many **events** (workshops), and an app belongs to one. `apps register` prints your **app key** (made from the event's slug and the name) and the values to set. Not deployed yet? Leave out `--prod`; add it later with `bunx user-hub prod set https://your-app.com --event spring-workshop --app "Your App"`. An app has a list of development URLs: add more with `bunx user-hub dev add <url> --event spring-workshop --app "Your App"`. `--new` refuses a name another app already has. See `bunx user-hub --help` for everything else, including the event's people. (The same can be done under **Apps** in the hub, with the values under **Setup**.) A new app made with `bun create user-hub@latest` does all of this with `bun run setup`.
|
|
53
53
|
|
|
54
54
|
### 3. Set the values
|
|
55
55
|
|
|
@@ -182,7 +182,7 @@ export const myVotes = query({
|
|
|
182
182
|
Run your dev server as usual and open it. With no token yet, it sends you to the hub, where you pick who to be (sign in to the hub with your account once per browser), and brings you back signed in. You stay signed in across reloads and restarts until that person's expiration in the hub (4 hours unless set otherwise).
|
|
183
183
|
|
|
184
184
|
- **Switch person:** open `<hub>/open/<your-app-key>`.
|
|
185
|
-
- **Different port:**
|
|
185
|
+
- **Different port:** add it to the app's development URLs: `user-hub dev add http://localhost:<port>` (with `--event` and `--app` outside a starter app). The hub only sends tokens to registered URLs.
|
|
186
186
|
- **Production:** someone without a token sees "Scan your badge to sign in". Pass `signedOut={…}` to `<HubSignedIn>` to style that screen.
|
|
187
187
|
|
|
188
188
|
## Sign out
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@ Registering apps, signing a folder in to the hub and managing people is done wit
|
|
|
20
20
|
| Facilitator-only pages or actions | [references/roles.md](references/roles.md) |
|
|
21
21
|
| Running it locally, going to production, or the hub moved | [references/dev-and-production.md](references/dev-and-production.md) |
|
|
22
22
|
|
|
23
|
-
A starter app is one whose `package.json` has `"setup": "user-hub setup"`: for it, prefer `bun run setup` (with `--event
|
|
23
|
+
A starter app is one whose `package.json` has `"setup": "user-hub setup"`: for it, prefer `bun run setup` (with `--event`) over doing the steps by hand, and `user-hub dev` / `user-hub prod` for its development URLs and production URL.
|
|
24
24
|
|
|
25
25
|
## Ask the human first
|
|
26
26
|
|
|
@@ -28,7 +28,7 @@ Never guess these; ask:
|
|
|
28
28
|
|
|
29
29
|
1. **Which event** the app is for (the CLI lists them). Create an event only when the human asks.
|
|
30
30
|
2. **The app's name** in the hub, unique within the event.
|
|
31
|
-
3. **Its local
|
|
31
|
+
3. **Its local URLs** (usually `http://localhost:3000`; an app has a list of development URLs) and its **production URL** once deployed.
|
|
32
32
|
4. **Which Convex deployments** it uses (dev, prod), so the values go on each.
|
|
33
33
|
|
|
34
34
|
The hub's URL also comes from the human. It goes in three places with the same value: `HUB_URL` (saved by `user-hub login`), `HUB_ISSUER` on Convex, and `VITE_HUB_URL` in the frontend env.
|
|
@@ -18,7 +18,7 @@ bunx user-hub apps register --event <slug> --name "<app name>" --new --dev http:
|
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
- `--new` never takes over another app: a taken name exits with code 3 and changes nothing. Ask the human for another name. Drop `--new` only when updating this app's own registration later.
|
|
21
|
-
- Leave out `--prod` until the app is deployed
|
|
21
|
+
- Leave out `--prod` until the app is deployed; then set it with `bunx user-hub prod set <url> --event <slug> --app "<app name>"`. An app has a list of development URLs: add others with `bunx user-hub dev add <url> --event <slug> --app "<app name>"`.
|
|
22
22
|
- It prints the app **key** (`<event slug>-<name>`), `HUB_ISSUER`, `HUB_JWKS` and `VITE_HUB_URL`. With `--json`: `key`, `env`, `hubUrl`.
|
|
23
23
|
|
|
24
24
|
## 3. Set the values
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## Your dev server
|
|
4
4
|
|
|
5
|
-
Run the app on the development
|
|
5
|
+
Run the app on one of the development URLs registered with the hub (an app has a list of them). With no token, it sends the browser to the hub, where the human (signed in to the hub once per browser) picks who to be, and comes back signed in. That lasts across reloads until the person's session in the hub ends (4 hours unless set otherwise).
|
|
6
6
|
|
|
7
7
|
- **Switch person:** open `<hub>/open/<key>`.
|
|
8
|
-
- **Another port:** the hub only sends tokens to registered URLs. Starter apps: `
|
|
8
|
+
- **Another port:** the hub only sends tokens to registered URLs. Starter apps: `bunx user-hub dev add http://localhost:<port>` and change the port in the `dev` script too. Others: the same with `--event <slug> --app "<the app's name>"`. `bunx user-hub dev list` shows them, `dev remove <url>` drops an old one.
|
|
9
9
|
- **Test people:** `bunx user-hub people create --name "Test Person" --team Test` (user-hub-cli skill).
|
|
10
10
|
- This redirect only happens on local addresses (localhost, 127.x, 10.x, 172.16-31.x, 192.168.x, *.local). In production a person without a token sees "Scan your badge to sign in".
|
|
11
11
|
|
|
@@ -13,8 +13,8 @@ Run the app on the development URL registered with the hub. With no token, it se
|
|
|
13
13
|
|
|
14
14
|
Badge scans reach the app only once the hub knows its production URL. Ask the human for the deployed URL (never guess), then:
|
|
15
15
|
|
|
16
|
-
- **Starter apps:** `
|
|
17
|
-
- **Other apps:** `bunx user-hub
|
|
16
|
+
- **Starter apps:** `bunx user-hub prod set https://<deployed url>`. It also sets `HUB_ISSUER` and `HUB_JWKS` on the production Convex deployment.
|
|
17
|
+
- **Other apps:** `bunx user-hub prod set https://<deployed url> --event <slug> --app "<the app's name>"`, then `bunx convex env set --prod HUB_ISSUER '…'` and `… HUB_JWKS '…'` (`bunx user-hub apps register --event <slug> --name "<the app's name>"` without `--new` prints them).
|
|
18
18
|
|
|
19
19
|
Then `bunx convex deploy`, set `VITE_CONVEX_URL` and `VITE_HUB_URL` on the host (at build time: Vite builds them in), and tell the human the app can be scheduled or forced live under **Schedule** of its event. While the event's badges go to the app list, a listed app with a production URL appears there straight away.
|
|
20
20
|
|