Access
Apps require signing in by default. One level per app, in app({ access }):
| access | who |
|---|---|
signedIn (default) |
anyone with a Google account |
org |
the app's organization (its members and its Workspace domain) |
private |
the owner and the people they add |
public |
anyone, including guests without an account |
- Until the visitor may use the app, every route shows Canica's sign-in screen (the app's icon and name, who may use
it, "Sign in with Google"; it comes back to the page they asked for); a signed-in person it is not shared with sees
"You don't have access" (another account, sign out). No app data is fetched before, and the server refuses
everyone else (queries, mutations, actions, uploads, agents). Your own screens:
setSignInScreen(({ gate }) => …),setNoAccessScreen(…)fromcanica/clientinsrc/main.tsx. - Handlers in non-public apps:
const me = yield* SignedInViewer(me.profileis there, no error to handle). publicapps have guests: each browser gets a user id; signing in keeps the guest's data (auth.onGuestUpgrademerges conflicts). There,page({ auth: "signedIn" }),<RequireSignIn>andyield* requireSignIn(fails withUnauthenticated) guard what needs an account.- Deployed,
canica access <level>changes it and wins over the code untilcanica access reset. The dev server and tests apply the code's level;org/privatelet in everyone signed in there, unless a test lists who is in:testApp(app, { access: { emails: ["ana@example.com"], domains: ["acme.com"] } }). canica devsigns in exactly as deployed: "Sign in with Google" through the platform's sign-in service, back tohttp://localhost:<port>(any port; no Canica account or setup). Open the app atlocalhost, not a LAN or Tailscale address. Offline the screen says "Sign-in needs internet". There are no test-user buttons: tests uset.as(name)and scenesas(name); scripts (e2e, the storyboard) sign in a test user with the dev server'sPOST /_canica/dev/test-sign-in{ name }(JSON, same origin) →{ userId }and the session cookie, as a real sign-in. Deployed apps have no such endpoint.- Sessions live on the server and travel in an HttpOnly cookie (
__Host-canica_session; the page's JavaScript never sees it). They last 30 days at most and end after 14 days unused (a public app's guests: 400 and 180).signOut()ends this browser's session on the server;signOutEverywhere()(orsignOut({ everywhere: true })) ends every session of that person in the app. Agents (MCP) keep their own tokens. - The first time someone signs in to an app, the platform's sign-in asks them to allow it ("
wants your name and email address"); after that it is silent. They can take it back at https://auth.canica.app/apps, which signs them out of that app.