Open Enterprise
Browse topics
DocumentationIdentity and access

Service accounts

A service account is an organization-owned machine principal. It is distinct from a person, an OAuth registration, and a trusted application backend credential. Removing its human creator does not remove the account. Teams contain people and nested teams; machines receive direct roles, assignments, relationships, and resource grants. A machine cannot become an organization owner or use human account-security flows.

Authority

The current native or AuthZEN permission model evaluates each machine. A credential can only reduce that authority. Its restrictions list explicit actions and registered tenant resources. OAuth adds the intersection of current client policy, resource policy, requested scopes, and an explicit machine binding. A client registration alone grants no machine access.

Use Service accounts, Roles, and Resource access in the React console. The equivalent SDK methods are serviceAccounts, permissions.assignments, and permissions.grants. Management uses service-accounts:read and service-accounts:write, plus delegation checks under the organization lock. Listing is bounded to 200 accounts per page. An account permits at most 50 current credentials.

Nightly imports across projects

For an import that touches a fixed set of projects, select each project in Permitted application resources when issuing the key or OAuth client. Both credential types accept up to 200 registered resources. At request time, check the specific project and action.

For an organization-wide report, register a collection such as { type: "report_collection", id: "monthly" } in each customer organization. Assign the service account report:read on that collection, and restrict its credential to that action and resource. The report endpoint authorizes that collection before querying rows scoped to the authenticated organization. Membership in the collection, row filtering, and the distinction between reading one project and exporting all projects belong to the application's data model.

Direct API keys

Create a named key with explicit resource and action restrictions. Copy its secret once; later listings return metadata only. Storage holds the SHA-256 verifier of a random 256-bit secret and its unambiguous credential ID. Send it in an authorization header:

HTTP
Authorization: Bearer oe_sk_mkc_identifier.random-secret
X-Organization-Id: org_demo

The example's /machine-api/projects/{id} supports a scoped read or deletion. Its backend calls /v1/machines/access for the exact organization, action, and resource. It retains the service-account ID and credential ID for audit attribution. A key never creates a human session.

OAuth client credentials

The operator must enable machine_access on the protected resource. An authorized customer administrator can create an organization-owned confidential machine client in the panel or SDK. Alternatively, bind an existing permitted confidential client explicitly. Bindings name one organization, one resource audience, scopes, and credential restrictions.

TypeScript
import { clientCredentials } from "@open-enterprise/sdk";

const token = await clientCredentials({
  issuer: process.env.ENTERPRISE_ISSUER!,
  clientId: process.env.MACHINE_CLIENT_ID!,
  clientSecret: process.env.MACHINE_CLIENT_SECRET!,
  organizationId: "org_demo",
  resource: "https://app.example/api",
  scopes: ["projects:read"],
});

Keep this call on the machine or trusted backend. It authenticates with client_secret_basic and requests grant_type=client_credentials. The result contains a short-lived access token. It has no refresh token or ID token. Machine claims identify principal_type: service_account, the account, and the credential. They contain no human user_id, authentication time, or MFA assurance.

The API and MCP examples verify signature, issuer, audience, and token type, then use live introspection. They intersect every business operation with current permissions and the credential's restrictions. The MCP example accepts an explicitly configured machine bearer token; it does not advertise automatic machine-client discovery. A machine credential scoped to existing projects cannot create an unregistered project.

Expiration and rotation

Optional machine credential expiration must be within 366 days. Planned rotation permits 0 to 86400 seconds of overlap; zero ends the previous credential immediately. OAuth machine rotation creates a new client ID and secret, allowing independent overlap and retirement. After overlap, the old binding fails both new token issuance and live introspection of its issued tokens.

Revoking one credential leaves other credentials independent. Disabling an account revokes all its credentials and raises its credential epoch. Re-enabling it requires new credentials and never restores old keys or tokens. Retirement is permanent and retains audit attribution. All these gates are synchronous database checks; workers and webhook delivery do not enforce access.

Lifecycle events use machine.* event types and contain account and credential identifiers. Events, audit records, errors, and ordinary responses never contain credential secrets or verifiers. The application still owns its business transaction and must retain its own concurrency checks.

Search documentation