Who is visiting: identity headers
How your App knows who is using it without any login code: Basemodo signs visitors in and sends their email, id and role with every request.
The headers
Every request reaches an App through Basemodo's gate, never directly. A new App is Private: the gate shows visitors a sign-in page and lets through only the people the App is shared with. On every request from a signed-in visitor it tells the App who they are:
X-Basemodo-Email: their email, lowercase.X-Basemodo-Id: their Basemodo id, stable even if their email changes; key your own records on it.X-Basemodo-Role: what they are to the App (owner,member, oreditorfor a Member the Owner also lets deploy it), when they have a role (a visitor let in by a Link, Public or Workspace Visibility has none). For an App a Workspace owns, each of its Admins is anowner.X-Basemodo-Jwt: the same, signed (EdDSA) with a key of this App, for an App that wants to verify it: claimsiss,aud(the App's URL),sub(the id),email,role,app,iat,exp(a few minutes). Verify it against the public key in the App's environment,BASEMODO_JWT_PUBLIC_KEY(PEM).
The gate removes every X-Basemodo-* header a client sends and never forwards its own cookies, so an App can trust these headers and must not implement login of its own. A visitor who has not signed in (on a Public App) arrives without them. Paths under /.basemodo/ belong to the gate and never reach the App.
Like any proxy, the gate says how the request reached it, as it saw it: X-Forwarded-Host holds the App's own host, X-Forwarded-For holds one address, the visitor's own, and X-Forwarded-Proto the scheme they used (https, or http for a Caller's call). It sets them itself and removes whatever a client sent of these, of Forwarded, X-Real-IP, X-Client-IP and the like, so a framework told to trust its proxy reads the truth, and an App that limits or logs by client address reads a value no visitor wrote. The connection itself comes from the gate: trust exactly one proxy (Express: app.set("trust proxy", 1), then req.ip; Flask: ProxyFix(app.wsgi_app, x_for=1, x_proto=1, x_host=1), then request.remote_addr; Rails, Django's SECURE_PROXY_SSL_HEADER). A request from another App of the same Owner (a Caller) carries that App's internal address instead.
A Link App's visitors sign in on Basemodo's sign-in page for the App, on basemodo.com, which says the App will get their email address, and go straight in. Someone who arrives signed in any other way, a sign-in the App starts itself included, is asked once whether to continue to the App as themselves: an App cannot sign a visitor in for itself.
Nobody is asked to sign in on a Public App: a visitor who has not signed in (someone signed in to Basemodo included, until they press Sign in) is a Guest, whom the App hears nothing about, and whom its Toolbar, unless it is turned off, shows as a G with a Sign in button. With Recognize on (recognize on, or [web] recognize = true; off by default), someone signed in to Basemodo is asked once, the first time they open the App, whether to continue as themselves, and arrives with the identity headers from then on; Cancel leaves them a Guest. A Public App that wants to know who a visitor is can also link to /.basemodo/sign-in?path= on its own address, with the path to come back to (<a href="/.basemodo/sign-in?path=/account">Sign in</a>), which opens Basemodo's sign-in page for the App on basemodo.com. The visitor signs in there with Google, GitHub or an emailed link and comes back to that path with X-Basemodo-Email, X-Basemodo-Id and X-Basemodo-Jwt, and no X-Basemodo-Role; the App's Owner, Editors and Members arrive with theirs.
A browser takes every App on basemodo.app for one site, so the gate keeps them apart. A request another App's page sends (a form it posts, a fetch, an image, a frame) arrives without the visitor's cookies or identity headers; only a link followed from another App keeps them, and an App another App frames shows signed out. The gate drops the Domain attribute of every cookie an App sets on basemodo.app: set cookies without one, named __Host- (__Host-cart=3; Path=/; Secure), so no other App can set or replace them. A Clear-Site-Data header clears no cookies on basemodo.app (the gate drops its "cookies" and "*", which would clear every App's): sign a visitor out by expiring the App's own cookies. An App with a sign-in of its own (passwords or passkeys) uses a custom domain, and a passkey's rpId is the App's own host, never basemodo.app.
The people an App is shared with are its Members before they ever visit (to assign a card to someone invited yesterday). The App's own JavaScript reads them from the gate in the visitor's browser: GET /.basemodo/members (a plain fetch) answers {"members": [{"id", "email", "role"}], "invited": [{"email"}]}. members holds the Owner (each Admin, for a Workspace's App), Editors and Members, then everyone who signed in to the App by Link or Workspace Visibility and may still reach it, without a role (never a whole Workspace); invited holds each pending invitation by email only. When an invited person first arrives they move to members with their id: match them by email then, and key on the id from then on. Only a visitor with a role gets the list; one without gets 403, and one not signed in 401. The gate answers it with the visitor's sign-in to the App, which only their browser holds, so the App's server (or a cron) cannot ask for it: it uses what the browser sent it, or the people it has seen.
POST /.basemodo/sign-out, sent by the App's own pages with a Basemodo-Toolbar header (any value; the Toolbar's Sign out sends it), signs the visitor out of this App only, not of Basemodo or other Apps: a Private App asks them to sign in again.
Search engines index no App unless its Owner or an Editor says so: the gate sends X-Robots-Tag: noindex, nofollow, noarchive on every answer and serves a robots.txt that disallows everything, replacing the App's own. Only for a Public App, indexing on (or [web] indexable = true) lets them in: the App's answers then leave as it sent them, and robots.txt lets crawlers in. Leaving Public turns it off.
On the App's HTML pages, the gate shows signed-in visitors Basemodo's Toolbar: a small pill with who is here now, the App's Visibility and a way to share it, which only shows (who can reach the App is changed on basemodo.com). It is the script /.basemodo/toolbar.js, same-origin, so a Content Security Policy with script-src 'self' lets it in and a nonce-only policy keeps it out. It is on for every App; toolbar off (or [web] toolbar = false) turns it off. On a Public App it shows visitors who have not signed in too, as Guests: a G face and Sign in, which brings them back signed in; the App still hears no one from a Guest. Public Apps made before that had it turned off.
Reading them
The headers arrive on every request, so "who is this?" is one line. Node with Express:
app.get("/", (req, res) => { const email = req.get("X-Basemodo-Email"); // "ana@example.com" const id = req.get("X-Basemodo-Id"); // keep your records under this const role = req.get("X-Basemodo-Role"); // "owner", "member", or undefined res.send(`Hello ${email ?? "stranger"}`);});Python with Flask:
from flask import Flask, request
app = Flask(__name__)
@app.get("/")def home(): email = request.headers.get("X-Basemodo-Email") is_owner = request.headers.get("X-Basemodo-Role") == "owner" return f"Hello {email or 'stranger'}"Store your own data under X-Basemodo-Id rather than the email: the id stays the same if the person's email changes.
Only the owner may see a settings page? Check the role:
if (req.get("X-Basemodo-Role") !== "owner") return res.status(403).send("Owners only");Verifying the signed token
The headers are safe to trust as they are, because every request passes through Basemodo, which removes any X-Basemodo-* header a visitor sends. If you want proof anyway (your App also runs somewhere else, or you pass the identity on to another service), verify X-Basemodo-Jwt with the public key Basemodo gives your App in BASEMODO_JWT_PUBLIC_KEY. Node, with the jose package:
import { importSPKI, jwtVerify } from "jose";
const key = await importSPKI(process.env.BASEMODO_JWT_PUBLIC_KEY, "EdDSA");
async function visitor(req) { const token = req.get("X-Basemodo-Jwt"); if (!token) return null; // not signed in (a Public App) const { payload } = await jwtVerify(token, key, { issuer: "https://basemodo.com", audience: "https://lunch-rota.basemodo.app", // your App's address }); return { id: payload.sub, email: payload.email, role: payload.role };}Python, with PyJWT and cryptography:
import osimport jwt
KEY = os.environ["BASEMODO_JWT_PUBLIC_KEY"]
def visitor(headers): token = headers.get("X-Basemodo-Jwt") if not token: return None claims = jwt.decode( token, KEY, algorithms=["EdDSA"], issuer="https://basemodo.com", audience="https://lunch-rota.basemodo.app", ) return {"id": claims["sub"], "email": claims["email"], "role": claims.get("role")}The token lives a few minutes and is for your App's address only: a token sent to one App is refused by any other.
Listing the people it is shared with
A kanban assigns cards to people who may not have opened it yet. Its pages read them from the browser, where the visitor is signed in to the App:
const response = await fetch("/.basemodo/members");if (response.ok) { const { members, invited } = await response.json(); // members: [{ id, email, role }], role missing for someone let in by the link // invited: [{ email }], pending invitations}A visitor without a role gets 403, so show the picker only to the App's Owner, Editors and Members. Store an assignment to someone invited under their email, and move it to their id once they appear in members.
Signing out
A page of your App can sign its visitor out of it, as the Toolbar's Sign out does:
await fetch("/.basemodo/sign-out", { method: "POST", headers: { "Basemodo-Toolbar": "1" },});The Basemodo-Toolbar header (any value) is required. It signs the visitor out of this App only, not of Basemodo or of other Apps; a Private App then asks them to sign in again.
Running your App on your own computer
When you run your App locally, nothing sets these headers. Fall back to a fixed person while developing (for example req.get("X-Basemodo-Email") ?? "me@localhost" when NODE_ENV is not production), and never in a deployed App.
Who gets in
The headers say who is visiting; whether they get in at all is the App's Visibility and its Members, set by its Owner: see Sharing. A visitor let in only because the App is Link or Public has no role. Requests to Public Paths (webhooks) carry no identity unless the caller happens to be signed in to the App. Neither does a request another App's page sends (a form it posts, a fetch, a frame), unless it is a link followed: see Apps share one site. A screenshot, and a browser that opened a Preview Link, arrive as the Owner or Editor who asked for it, with their headers: the App cannot tell them from that person's own browser.