VITE_BIJECTION_URL:
apps/main/src/client.ts
Sign people in
connect(url, { contract: "discover", token }) takes an auth adapter. The client asks it for the
current token on every call and every live connection, and reconnects when
the adapter reports a sign-in, a sign-out or a switch. The adapters are on
@bijectionhq/bijection/client:
apps/main/src/auth.ts
useClientAuth inside the
provider. Render the caller-specific subtree once the hook returns true.
apps/main/src/App.tsx
role.anyone class grant.
bijectionAuth() signs HTTP calls and watches with the browser’s session key.
Pass its token adapter and HTTP proof signer to connect.
Use a local development principal
Runbijection dev --as person:alice and open the loopback app URL it prints.
The browser and CLI calls with --as person:alice use the same person id in
that installation. In a test installation, k.as("person:alice") acts as
the same person, and person:alice is the id to use for grants.
bijection dev selects person:developer. Production uses the configured
auth adapter.
Servers, scripts and other providers
A server or a script can pass a fixed token or an async callback that renews the token within one authorization scope. Make one client per identity. For another provider, implementClientAuth. Have token({ refresh })
return the current token or return null after sign-out. Reject the request
if a signed-in credential is unavailable. Use subscribe(changed) to
notify the client synchronously when the principal, session, or audience
changes.
Accept pending invitations
acceptPendingInvitations(auth, accept, onError) runs accept each time a
person signs in, for an app that mounts the members library:
team.acceptance to follow the lookup and its
redemptions. The helper returns a cleanup function.