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 clientSourcePurpose
Me (Guards.me)foldkit-guardRow with signedIn, key, and top-level may flags
Row mayfoldkit-guardPer-row permission hint computed by the server
RemoteData.denied(err)foldkit-remoteSurfaces Unauthenticated (401) or Forbidden (403)
believing()foldkit-authFetch wrapper detecting account switches in other tabs
Site.accessfoldkit-siteRedirects 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.