Skip to content

Commit 0b9b02d

Browse files
MajorTalclaude
andcommitted
docs(auth-aware-ssr): drop stale getUserId/getRole bullets in functions library quick ref
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e52c564 commit 0b9b02d

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

AGENTS.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,7 @@ Quick reference of the public surface (full API lives in the private repo's `pac
187187
- **`db(req?)`** — caller-context PostgREST client. Inside an SSR request with a verified actor, mints a 60s actor JWT (`sub`, `project_id`, `session_id`, `authz_version`) so `run402.current_user_id()` resolves in RLS without any client-side header plumbing.
188188
- **`adminDb()`** — service-key client. Routes to `/admin/v1/rest/*`. Use only when the function acts on behalf of the platform, not the caller.
189189
- **`adminDb().sql(query, params?)`** — raw parameterized SQL, always BYPASSRLS.
190-
- **`getUserId(req)`** (v1.51+) — read the gateway-injected `x-run402-user-id` header. Non-null when a `requireAuth` or `requireRole` gate ran successfully on this dispatch.
191-
- **`getRole(req)`** (v1.51+) — read the gateway-injected `x-run402-user-role` header. Non-null when a `requireRole` gate ran successfully (value is guaranteed to be in `requireRole.allowed`).
190+
- For per-user gating in functions OUTSIDE the cookie-session flow: read `req.headers.get("x-run402-user-id")` / `req.headers.get("x-run402-user-role")` directly (the gateway injects these when a `requireAuth` / `requireRole` deploy-spec gate ran). The legacy `getUser(req)` / `getUserId(req)` / `getRole(req)` bare exports were retired in v3.0 — they now throw `R402_AUTH_UNKNOWN_EXPORT`. For the canonical cookie-session flow, use `auth.*` above.
192191
- **`email.send(opts)`** — send email from the project's mailbox (raw HTML or template).
193192
- **`ai.translate(text, to, opts?)`**, **`ai.moderate(text)`**, **`ai.generateImage({ prompt, aspect? })`** — project-billed AI helpers using the function's service-key auth.
194193
- **`assets.put(key, source, opts?)`** — in-function asset upload through the service-key `/apply/v1/service-asset-put` path. Uses the same CAS/activation substrate as deploy-time assets and returns SDK-compatible `AssetRef` snake_case + camelCase fields.

0 commit comments

Comments
 (0)