Commit 6d05222
fix(cli-auth): provision /cli-auth route (was 404 on instanode.dev) (#129)
User reported "That page is not provisioned" when CLI device-flow
emitted `https://instanode.dev/cli-auth?cli_session=…`. The route
wasn't defined on the marketing site — it had to be either on the
dashboard OR a redirect from instanode.dev to the dashboard.
Fix: defensive redirect route `/cli-auth` → `/login?cli_session=<id>`.
Details:
- The api currently emits the canonical `/login?cli_session=<id>`
path (cli_auth.go since commit 0c7991c, B13-P0-F1 2026-05-20).
- `/cli-auth` was never a real route — but it appears in
`cli/cmd/testapi_test.go` (the hermetic test mock writes
`https://instanode.dev/cli-auth?s=test`) and in any stale
terminal scrollback / chat transcript a user pastes.
- Without a route, `/cli-auth` fell through to the catch-all
NotFoundPage → 404.
Implementation:
- New `CliAuthRedirect` component in App.tsx normalizes both query
shapes: `?cli_session=<id>` and `?s=<id>` (test-mock shape) →
canonical `/login?cli_session=<id>`. Bare `/cli-auth` → `/login`.
- Route registered in App.tsx alongside the legacy /resources,
/vault, /team, /billing redirects.
- `scripts/prerender.mjs` adds `/cli-auth` to authShellRoutes so
`dist/cli-auth/index.html` is written at build time — otherwise
GH Pages would 404 before the SPA shell could boot the Navigate.
- `ROUTE_META['/cli-auth']` adds a sensible <title> for the brief
moment before the redirect runs.
- 5 unit tests in `src/App.cli-auth.test.tsx` lock in the contract:
param preservation, ?s→cli_session rewrite, bare-fallback, URL
encoding of reserved characters, cli_session-wins-over-s when
both are present.
Does NOT touch the working `/login?cli_session=...` flow that the
api emits — that path remains canonical. This is purely a defensive
redirect for the legacy URL shape.
Verification:
- `npx tsc --noEmit`: clean
- `npx vitest run`: 769 passed, 3 skipped, 0 failed (full suite)
- `npm run build`: SSR prerender wrote 4 auth SPA shells (was 3);
`dist/cli-auth/index.html` exists with title "Signing in CLI… · instanode"
Co-authored-by: Claude <claude@anthropic.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent b69b4db commit 6d05222
3 files changed
Lines changed: 186 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
181 | 189 | | |
182 | 190 | | |
183 | 191 | | |
| |||
416 | 424 | | |
417 | 425 | | |
418 | 426 | | |
419 | | - | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
420 | 433 | | |
421 | 434 | | |
422 | 435 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
211 | 241 | | |
212 | 242 | | |
213 | 243 | | |
| |||
349 | 379 | | |
350 | 380 | | |
351 | 381 | | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
352 | 389 | | |
353 | 390 | | |
354 | 391 | | |
| |||
0 commit comments