docs(dev): pin AUTH_URL to the tenant subdomain
Live-stack debugging caught this: Auth.js v5 builds the OAuth redirect_uri from AUTH_URL, NOT from the request Host header, even with AUTH_TRUST_HOST=true. If you visit http://acme.localhost:3000 with AUTH_URL=http://localhost:3000, Keycloak rejects the token exchange because the PKCE cookie was set on acme.localhost but the callback URL Auth.js sent was localhost. Fix in dev: pin AUTH_URL to the subdomain you're testing on. In prod, orca-proxy passes the right host via X-Forwarded-Host and AUTH_URL is set to the apex. Updates .env.example with a long-form note + sets AUTH_URL to the acme tenant so a copy/paste-and-go workflow Just Works. Adds a 'AUTH_URL gotcha' callout to the local-dev section in README. Refs: M5.1
This commit is contained in:
@@ -38,6 +38,8 @@ make dev # next dev on http://localhost:3000
|
||||
|
||||
Seed login (from the dev-stack realm): `test@breakpilot.dev` / `test`.
|
||||
|
||||
> **AUTH_URL gotcha:** Auth.js v5 builds the OAuth `redirect_uri` from `AUTH_URL` — not from the request Host header, even with `AUTH_TRUST_HOST=true`. For multi-tenant dev work, pin `AUTH_URL` to the subdomain you log in on (e.g., `http://acme.localhost:3000`); otherwise Keycloak rejects the token exchange with `invalid_grant: Incorrect redirect_uri`. In prod, orca-proxy passes the right host via `X-Forwarded-Host` and `AUTH_URL` is set to the apex (`https://breakpilot.com`).
|
||||
|
||||
`make test` / `make lint` / `make typecheck` / `make build` run vitest / eslint / tsc / next build respectively.
|
||||
|
||||
Env vars live in `.env.example`. Copy to `.env.local` for local overrides (gitignored).
|
||||
|
||||
Reference in New Issue
Block a user