Skip to main content

Auth integration

Your host identity provider issues the JWT; Convex verifies it against its configured issuer, audience and JWKS. Trusted principal, membership and grant records determine Cortex access. Browser claims never provision those records.

Configure a custom JWT provider​

The additive installer accepts a reviewed JSON file through --jwt-provider:

{
"type": "customJwt",
"issuer": "https://identity.example.com",
"jwks": "https://identity.example.com/.well-known/jwks.json",
"algorithm": "RS256",
"applicationID": "your-cortex-audience"
}

The supported algorithms are RS256 and ES256. Preserve an existing supported host auth integration rather than replacing its configuration. Provision the verified issuer/subject separately through trusted development administration.

Supply and refresh the token​

Pass fetchToken({ forceRefreshToken }) to CortexRuntimeClient. Return the host provider's current token, force refresh when requested, and return null after sign-out. Use client.refreshAuth() after your provider can supply a fresh credential. The official Convex handshake verifies it; callback completion alone does not authenticate the connection.

Use one owned client per protected view/session. On onAuthChange(false), clear messages, history, recalled context, artifacts, jobs and previews. On resource revocation errors, clear that protected view and close its client. An old connection's late error must not close a newer authenticated connection.

The client bounds the handshake (10 seconds by default), aborts owned private requests/previews at authority expiry, and invalidates old handles when identity/scope changes. Run IDs and reconnect snapshots still require fresh authorization.

Required boundaries​

  • Keep deployment/provider keys, callback secrets and graph passwords out of browser variables and logs.
  • Use trusted own, space or tenant grants and only the required capabilities.
  • Recheck current grants and source revisions at effect/delivery boundaries; a valid JWT can outlive a revoked membership.
  • Use storage:read/storage:write for private asset operations and a registered scoped service JWT for graph workers.

See authentication, isolation and auth provider adapters.