Skip to main content
Bijection can create AuthKit environments in a WorkOS account made on your behalf. By default WorkOS gives you only two environments, but giving each Bijection dev deployment its own AuthKit environment is useful for isolating development user data and configuration changes between multiple developers or agents working in parallel. The Bijection CLI will configure AuthKit environments, regardless of whether Bijection or you created them, if the WORKOS_CLIENT_ID and WORKOS_API_KEY environment variables are present in the build environment or the Bijection deployment. While developing locally, Bijection can write environment variables to .env.local to make setting up an AuthKit environment a breeze. This automatic configuration is available whether you’re starting a new application or adding WorkOS AuthKit to an existing application. Read on for some additional details about how the auto-configuration works and some things that you may need to configure manually based on your specific needs.
Creating or disconnecting the managed WorkOS team requires the team Admin role. Creating or configuring a deployment’s WorkOS environment requires permission to deploy to that deployment, which Developers and Admins have. Creating or deleting a project environment requires the Developer or Admin role.

Production and preview deployments

Your hosting provider builds and serves your frontend with its own environment variables. Set the WorkOS variables your framework reads there, such as WORKOS_CLIENT_ID, WORKOS_API_KEY, WORKOS_COOKIE_PASSWORD and the redirect URI, for production and for previews. For production, add a prod entry and run bijection deploy --installation my-app:prod, with the variables its ${buildEnv.NAME} templates need set in your shell or .env.local. Read the credentials it wrote with bijection env get WORKOS_CLIENT_ID --installation my-app:prod and bijection env get WORKOS_API_KEY --installation my-app:prod. To share one WorkOS environment across preview deployments, create a non-production environment in the WorkOS dashboard. Set its client ID and API key as preview defaults, naming any preview deployment of the project:
Manage the environment and register preview callback URLs and CORS origins in the WorkOS dashboard.

How it works

Provisioning is an explicit installation operation. The app tree reviews the public client IDs that its AuthKit issuer accepts.

Finding the AuthKit environment

The CLI looks for WorkOS credentials WORKOS_CLIENT_ID and WORKOS_API_KEY in the following order:
  1. Environment variables in the build environment shell or .env.local file
  2. Bijection deployment environment variables
In remote build environments (e.g. building a project in Vercel, Netlify, Cloudflare) if these two environment variables are not found, the build will fail. During local dev, credentials are next fetched from the Bijection management service for a new or existing AuthKit environment. A link to this deployment in the WorkOS dashboard is shown by bijection installation workos status <project>:<name>.
Creating a managed team or environment needs WorkOS platform credentials on the Bijection management service. Configuring an existing environment uses its deployment’s WORKOS_API_KEY and needs no Platforms onboarding.

Configure the frontend

In WorkOS, register the app’s exact origin and callback URL. Copy the public client ID into the frontend environment, and trust it for the backend issuer with bijection issuer trust signIn --client-id <client-id> (provisioning trusts a client it creates). The client ID is carried by a trust grant in sys.grants, never by code. Keep the WorkOS API key in installation credentials.