Skip to main content
Note: This is an advanced feature! We recommend sticking with the supported third-party authentication providers. Bijection can be integrated with any identity provider supporting the OpenID Connect protocol. At minimum this means that the provider can issue ID tokens and exposes the corresponding JWKS. The ID token is passed from the client to your Bijection backend which ensures that the token is valid and enables you to query the user information embedded in the token, as described in Auth in Functions.

Server-side integration

Just like with Clerk and Auth0, the backend needs to be aware of the domain of the Issuer and your application’s specific applicationID for a given identity provider. Declare the verifier with issuer.oidc.
bijection/sign-in.ts
Place this export in the app tree in bijection/app.ts. After deploying, trust the provider’s values for it:
Trusting an issuer issues a grant that carries attest for that issuer and its values. Only the installation’s identity admin issues it, never code: no deploy and no bijection env set changes it. Each identity that signs in through the issuer is bound by a grant under the trust that carries speak for its principal, and each session is a grant under that binding, so revoking the trust ends every binding and session under it. The --audience value must exactly match the aud field of your JWT and the --issuer-url value must exactly match the iss field of the JWT. Use a tool like jwt.io to view an JWT and confirm these fields match exactly. If multiple providers are provided, the first one fulfilling the above criteria will be used. If you’re not able to obtain tokens with an aud field, you’ll need to instead configure a Custom JWT. If you’re not sure if your token is an OIDC ID token, check the spec for a list of all required fields. OIDC requires the routes ${url}/.well-known/jwks.json and ${url}/.well-known/openid-configuration. url may include a path like https://your.issuer.url.com/api/auth. This isn’t common for third party auth providers but may be useful if you’re implementing OIDC on your own server. For a native sign-in source, set backChannelLogout: true and register <installation API URL>/api/bijection/identity/backchannel-logout with your issuer to receive OIDC back-channel logout. The receiver verifies the signed logout token against the installed issuer and client. The same registration works for an issuer served by the deployment itself.

Declare a durable authorization-code exchange

For native sign-in, add one receiver for the token URL in the issuer’s discovery document. The receiver declaration separates the HTTPS origin and literal POST path.
bijection/sign-in-receiver.ts
Place the receiver in the installed app tree. Sessions supplies the private authorization-code request, opens the exact provider credential if required and holds the reply for its continuation. For a confidential client, declare auth.kind as "oauth2", set tokenEndpoint to this full URL and set clientId and clientSecret to the source’s exact client and named secret. The client secret uses form-body authentication. A source that renews or revokes provider grants declares separate one-operation receivers named sessionRefresh or sessionRevocation with the appropriate fixed endpoint. To receive Continuous Access Evaluation Profile (CAEP) events, declare caepEvents on the provider and register <installation API URL>/api/bijection/identity/events/caep as the push (RFC 8935) delivery endpoint with your event transmitter:
session-revoked ends the subject’s native sessions. sessionIdentifier: "providerSid" limits a session-scoped event to sessions signed in under that provider sid. "subject" ends every session of the subject. credentialChange, assuranceLevelChange and tokenClaimsChange each take endSessions or requireReauthentication. Other events are acknowledged without effect.

Client-side integration

Give the typed client an auth adapter as its token: connect(url, { token: auth }). The client asks the adapter for the current token on every request and live connection. authkit() and clerk() from @bijectionhq/bijection/client read the state of their provider’s React hook (useClientAuth(auth, state) in a component inside the provider). AuthKit also supplies session evidence through provider callbacks. For any other provider, implement ClientAuth. Have token({ refresh }) return the current token, return null when signed out, and reject if a signed-in credential is unavailable. Use subscribe(changed) to call changed synchronously when the principal, session, or audience changes. Keep that generation stable across ordinary token refreshes. A server or test that holds a fixed token passes it as a string: connect(url, { token }). For sessions using Bijection Auth, use its React integration and browser proofs.