Skip to content
Local environment Preproduction — not production data

OAuth & API token

The Factorial Developer Portal manages the OAuth flow for you. When a customer installation is provisioned, the platform sets a FACTORIAL_TOKEN in that deploy-{deployId} workspace, so your processes can assume it exists — no token handling in your code.

FactorialClient reads this token automatically:

const { FactorialClient } = fcode.import("FactorialClient");
// FACTORIAL_TOKEN is already present in the deploy workspace.
const client = await FactorialClient.create();

If you need the raw token (for a call the client doesn’t cover yet), read it from the workspace’s Team Variables:

const token = fcode.env.FACTORIAL_TOKEN;

FACTORIAL_TOKEN expires one hour after it is issued. A client built with createFactorialClient from the factorial-sdk module renews it for you shortly before it expires, so a process that runs for hours keeps working:

const { createFactorialClient } = fcode.import("factorial-sdk");
const factorial = createFactorialClient();

The renewed token is also written to fcode.env.FACTORIAL_TOKEN. Code that reads the variable without ever using the client does not renew it, and fails once the token expires. The token is a JWT, so its expiry is in its own exp claim.

To run a process locally against a dev installation, use Copy token on that installation in the dashboard. The copied token lasts at least 20 minutes.