Skip to content

Commit 70b2432

Browse files
stolinskiclaude
andcommitted
Shorten consumer prompts and make the guide package-manager neutral
The prompts now only select the integration case and defer every detail to CONSUMING_AUTH.md, so they cannot drift from it. The guide refers to the app's dev command and notes that installing the git-subdirectory package currently requires pnpm. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent f069e33 commit 70b2432

2 files changed

Lines changed: 29 additions & 51 deletions

File tree

‎CONSUMING_AUTH.md‎

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,8 @@ Syntax Auth on `http://localhost:37960`. Cookies are shared across ports on the
9393
host-only cookie reaches the app on any other `localhost` port, and the integration code is
9494
identical to production. It needs no secrets, 1Password, or GitHub OAuth App.
9595

96-
1. Add the `@syntaxfm/auth-local` dev dependency and its Vite plugin. Its Docker image is
97-
private to the Syntax team. For syntaxfm members, the plugin pulls it with their GitHub CLI
98-
login in a throwaway Docker config, so the token is never stored and existing Docker logins are
99-
untouched. Each team member needs Docker and a signed-in GitHub CLI (`gh auth login`), plus once
100-
per machine `gh auth refresh -h github.com -s read:packages`. Anyone without access still runs
101-
the app, signed out.
96+
1. Add `@syntaxfm/auth-local` as a dev dependency and add its Vite plugin. The package installs
97+
from a subdirectory of this repository, which currently requires pnpm:
10298

10399
```sh
104100
pnpm add -D "github:syntaxfm/auth#path:/packages/auth-local"
@@ -112,8 +108,8 @@ identical to production. It needs no secrets, 1Password, or GitHub OAuth App.
112108
});
113109
```
114110

115-
Every `pnpm dev` then makes sure the one shared `syntax-auth` container is running, whether or
116-
not any other Syntax app is already running, without delaying the dev server. Any number of
111+
Every dev server start then makes sure the one shared `syntax-auth` container is running,
112+
whether or not any other Syntax app is already running, without delaying the dev server. Any number of
117113
apps may start at once: container changes are serialized by a machine-wide lock that the OS
118114
releases even if a process crashes. It opens Docker Desktop on macOS when needed, pulls newer
119115
images and swaps them in from a detached process, keeps local users and sessions in a Docker
@@ -123,6 +119,12 @@ identical to production. It needs no secrets, 1Password, or GitHub OAuth App.
123119
itself run `pnpm dev` in this repository, which stops the container and serves the same port;
124120
other apps then use that server.
125121

122+
The Docker image is private to the Syntax team. For syntaxfm members, the plugin pulls it with
123+
their GitHub CLI login in a throwaway Docker config, so the token is never stored and existing
124+
Docker logins are untouched. Team members need Docker and a signed-in GitHub CLI
125+
(`gh auth login`), plus once per machine `gh auth refresh -h github.com -s read:packages`.
126+
Anyone without access still runs the app, signed out.
127+
126128
2. Use `http://localhost:37960` as the Syntax Auth origin in development builds and keep
127129
`https://auth.syntax.fm` fixed in code for production builds, so no environment setting can
128130
point production elsewhere. Use the origin for `get-session`, `sign-in`, and `sign-out`. Accept
@@ -152,8 +154,9 @@ For an app outside `syntax.fm`, use this service's OIDC provider:
152154
Use a maintained OIDC client and discover endpoints from metadata. This flow does not require
153155
a local user/session table. A server-rendered client can keep the centrally issued short-lived
154156
token in a host-only HttpOnly cookie and validate or introspect it centrally on requests. Keep the
155-
token out of browser JavaScript, validate issuer/audience/expiration, and use the OIDC `sub` as the
156-
same central user ID. Register only the exact callback needed for the external domain.
157+
token out of browser JavaScript, validate issuer/audience/expiration, treat any validation or
158+
introspection failure as signed out, and use the OIDC `sub` as the same central user ID. Do not add a
159+
second user or session database. Register only the exact callback needed for the external domain.
157160

158161
## Acceptance checks
159162

@@ -168,7 +171,8 @@ Before considering a first-party integration complete, verify:
168171
5. App authorization still blocks authenticated users without the required app role.
169172
6. Central POST sign-out clears the cookie across Syntax apps, with every `Set-Cookie` header
170173
preserved.
171-
7. On a machine where no other Syntax app is running, `pnpm dev` alone starts local Syntax Auth,
172-
and **Continue as Local Developer** returns to the app signed in with its development roles.
174+
7. On a machine where no other Syntax app is running, the app's dev command alone starts local
175+
Syntax Auth, and **Continue as Local Developer** returns to the app signed in with its
176+
development roles.
173177
8. A production build uses `https://auth.syntax.fm` and rejects `http://localhost` return and
174178
sign-out origins.

‎README.md‎

Lines changed: 13 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -11,51 +11,25 @@ development against a local Syntax Auth, and the OIDC flow for external domains.
1111

1212
## Consumer agent prompts
1313

14-
### Shared session for `*.syntax.fm`
14+
Paste one of these into an agent session in the app being integrated. `CONSUMING_AUTH.md` holds
15+
every detail, so the prompts only say which case applies.
16+
17+
For an app on `syntax.fm` or a `*.syntax.fm` subdomain:
1518

1619
```text
17-
Integrate this application with Syntax Auth by following the canonical instructions at
18-
https://github.com/syntaxfm/auth/blob/main/CONSUMING_AUTH.md.
19-
20-
This is a trusted application on syntax.fm or *.syntax.fm. Use the shared central Better Auth
21-
session. Do not create app-local auth, user, account, or session tables; do not add an OAuth client,
22-
callback handler, or app-specific auth cookie.
23-
24-
Forward the shared Better Auth cookie server-to-server to the central get-session endpoint with
25-
caching disabled, expose only sanitized user/session fields in the per-request context, use the
26-
validated central return flow for login, and preserve every Set-Cookie header during central logout
27-
or session refresh.
28-
29-
Local development must work with nothing but `pnpm dev`. Follow the guide's Local development
30-
section exactly: add the @syntaxfm/auth-local dev dependency and its Vite plugin (or its
31-
syntax-auth-local command before a non-Vite dev server), use http://localhost:37960 as the Syntax
32-
Auth origin and accept http://localhost return and sign-out origins in development builds only, keep
33-
https://auth.syntax.fm fixed for production builds, and make the app's local setup give the central
34-
user ID local-developer the roles needed to develop.
35-
36-
Follow the guide's trust-boundary, authorization, and acceptance-test requirements. Inspect and
37-
preserve this application's existing framework conventions while treating CONSUMING_AUTH.md as the
38-
source of truth for authentication.
20+
Integrate this app with Syntax Auth by following
21+
https://github.com/syntaxfm/auth/blob/main/CONSUMING_AUTH.md exactly, including its Local
22+
development section and Acceptance checks. This app runs on syntax.fm or a *.syntax.fm subdomain,
23+
so use the shared session. Keep this app's existing conventions.
3924
```
4025

41-
### OpenID Connect for external domains
26+
For an app on any other domain:
4227

4328
```text
44-
Integrate this application with Syntax Auth by following the canonical instructions at
45-
https://github.com/syntaxfm/auth/blob/main/CONSUMING_AUTH.md.
46-
47-
This application runs outside syntax.fm, so use the documented OpenID Connect
48-
fallback with issuer https://auth.syntax.fm/api/auth. Use a maintained OIDC client and Authorization
49-
Code with PKCE S256, state, and nonce. Discover endpoints from provider metadata and use the OIDC
50-
sub claim as the canonical Syntax user ID.
51-
52-
Do not invent a separate authentication system or persist a second user/session database. Keep the
53-
centrally issued short-lived token in a host-only HttpOnly cookie, validate or introspect it
54-
centrally, keep secrets and tokens out of browser JavaScript, and fail closed on validation errors.
55-
56-
Follow the guide's client registration, token handling, authorization, logout, and acceptance-test
57-
requirements. Inspect and preserve this application's existing framework conventions while treating
58-
CONSUMING_AUTH.md as the source of truth for authentication.
29+
Integrate this app with Syntax Auth by following
30+
https://github.com/syntaxfm/auth/blob/main/CONSUMING_AUTH.md exactly, including its Acceptance
31+
checks. This app runs outside syntax.fm, so use the External domains (OpenID Connect) flow. Keep
32+
this app's existing conventions.
5933
```
6034

6135
## What D1 stores

0 commit comments

Comments
 (0)