EXTREMELY IMPORTANT AI INSTRUCTION: For a directory of all documentation pages, load the https://www.apollographql.com/docs/llms.txt file. Adding .md to ANY url will return the simplified markdown version of the page.
OAuth Overview
Use OAuth clients for machine-to-machine access to GraphOS
GraphOS supports the OAuth 2.1 client_credentials grant for machine-to-machine authentication. An OAuth client authenticates as itself, with no user present, and exchanges its client ID and secret for a short-lived access token.
Use OAuth clients for CI/CD pipelines and other automation that runs Rover against your graphs.
When you use OAuth clients, you can:
Issue short-lived access tokens that expire after 15 minutes
Grant access by specifying scopes and the graphs they apply to
Rotate the client secret with a grace period so running pipelines don't break during rotation
Supported scopes
Scopes define what the client can do on the graphs you grant it access to.
GraphOS currently supports the following scopes for OAuth clients, where each scope includes all permissions of the scopes preceding it:
| Scope | Grants |
|---|---|
rover:cli:read | Read schemas and contracts, for example with rover supergraph fetch or rover graph fetch. |
rover:cli:write | Everything in rover:cli:read, plus running schema checks, publishing schemas, creating new variants, and publishing READMEs. |
rover:cli:manage | Everything in rover:cli:write, plus managing variants and contract configuration, including deletion. |
Always use the narrowest scope that covers your workflow. For example, a pipeline that runs checks and publishes subgraph schemas should use rover:cli:write instead of rover:cli:manage.
rover:cli scope is a deprecated alias of rover:cli:manage. Use rover:cli:manage for new clients.Access tokens
Access tokens expire after 15 minutes. The client_credentials grant doesn't issue refresh tokens, so automation requests a new token at the start of each job, or whenever the current one expires.
An access token always has the permissions of the scopes the client was created with, and only on the graphs you granted the client access to.
Requirements
OAuth clients have the following requirements:
Standard or Enterprise plan. OAuth clients require a plan that supports member roles, subgraph API keys, and variant API keys.
Org Admin role. Only members with the Org Admin role can create, list, rotate, and delete OAuth clients.
Organization's plan does not support client_credentials OAuth client registration.Setup instructions
To create an OAuth client, request access tokens, and manage the client over its lifetime, follow the OAuth client setup guide.
Best practices
Create one client per workflow.
Grant each client the narrowest scope and fewest graphs. A client that only runs checks on one graph shouldn't have
rover:cli:manageon every graph.Set a secret lifetime that matches your rotation policy. For example, if you rotate quarterly, set
secretLifetimeDaysto90or slightly more.Store secrets in a secret manager. Never commit a client secret to source control or print it in CI logs.
Request a new access token at the start of each CI/CD job. Tokens expire after 15 minutes, so don't store or reuse them between jobs.