Auth / Auth and Guard
Drawing capabilities and handling refusals in the browser
Rules run on the server; the client renders UI from filtered rows, server-computed may flags, and RemoteData.denied errors:
| On the client | Source | Purpose |
|---|---|---|
Me (Guards.me) | foldkit-guard | Row with signedIn, key, and top-level may flags |
Row may | foldkit-guard | Per-row permission hint computed by the server |
RemoteData.denied(err) | foldkit-remote | Surfaces Unauthenticated (401) or Forbidden (403) |
believing() | foldkit-auth | Fetch wrapper detecting account switches in other tabs |
Site.access | foldkit-site | Redirects unauthenticated visitors away from private UI |
Draw from may, recover from denied. Hide buttons when may says no, prompt for sign-in (and call Remote.forget) on 401 Unauthenticated, and surface a permission error on 403 Forbidden.
Because may is only a UI hint, the server ignores client may flags and re-evaluates every write rule when a mutation arrives. If the client already holds a may saying no, it can reject the write locally as Forbidden right away to save a round trip. See what may tells a reader for details.