infisical run can fetch secrets at runtime inside a remote development environment using the developer’s own permissions.
A delegated OAuth token can never do more than the user who authorized it. Scopes only narrow what the token can do; they never grant access the user does not already have. When the user’s access changes or their session is revoked, every token issued for them through OAuth is affected immediately.
Concept
OAuth Applications turn Infisical into an OAuth 2.0 authorization server. The model has three parties:- OAuth application (client) - the external platform you register in Infisical. It holds a client ID and client secret.
- User (resource owner) - the Infisical user who authorizes the application to act on their behalf.
- Infisical (authorization + resource server) - issues the tokens and serves the protected API.
Flow
Scopes
Scopes are a coarse, named contract for what a delegated token is allowed to do. The requested scopes are passed as a space-delimitedscope parameter on the authorization request and are shown to the user on the consent screen.
| Scope | Grants |
|---|---|
secrets:read | Read secrets, folders, and imports |
secrets:read is the only scope available today, supporting the read-only infisical run use case. Requesting an unrecognized scope rejects the authorization request rather than silently dropping it.Creating an OAuth application
OAuth applications are managed at the organization level. You need permission to manage OAuth applications in the organization.Open the OAuth Applications settings
Head to Organization Settings and select the OAuth Applications tab.
Add an application
Press Add OAuth application and fill in the details:
- Name (required): A friendly name shown to users on the consent screen.
- Description (optional): A short note about what the application is used for. Also shown on the consent screen.
- Redirect URIs (required): One URI per line. The authorization flow will only ever redirect to one of these exact URIs. Each must use
https://;http://is allowed only for loopback addresses such aslocalhost,127.0.0.1, and::1. - Require PKCE (S256): When enabled, authorization requests that do not include a PKCE code challenge are rejected. Recommended for public clients.
OAuth 2.0 endpoints
All endpoints are served under the/api/v1/oauth prefix.
Authorization endpoint
response_type(required): Must becode.client_id(required): The application’s client ID.redirect_uri(required): Must exactly match one of the application’s registered redirect URIs.scope(optional): Space-delimited list of requested scopes (for example,secrets:read).state(optional but recommended): Opaque value echoed back on the callback to prevent CSRF.code_challenge/code_challenge_method(optional,S256): PKCE parameters. Required if the application has Require PKCE enabled.
redirect_uri with a one-time code (and the state, if provided). If the user denies, it redirects with error=access_denied.
Token endpoint
Authorization: Basic <base64(client_id:client_secret)>) or in the request body as client_id and client_secret.
To exchange an authorization code:
grant_type=authorization_codecode: The authorization code from the callback.redirect_uri: Must match the one used in the authorize request.code_verifier: The PKCE verifier (required when a code challenge was used).
grant_type=refresh_tokenrefresh_token: A previously issued refresh token.
Validation endpoint
200 with { "active": true } confirms the token is valid.
Accessing the API
Use the access token as a standard Bearer token on the supported read-only secret endpoints:Security model
- Delegated access is bounded by the user. Tokens are intersected with the authorizing user’s CASL permissions on every request. They cannot exceed what the user can do, and revoking the user’s access revokes the token’s access.
- Read-only by design. Only a deliberately minimal set of read-only secret-fetch endpoints accept OAuth tokens. Write endpoints and account endpoints (MFA, session management, TOTP, and similar) never accept them.
- MFA is enforced at consent. If the user’s organization requires MFA, the consent flow requires the matching MFA challenge to be completed before an authorization code is issued.
- Strict redirect URIs. Authorization only ever redirects to an exact registered URI. Non-loopback URIs must use
https://. - One-time authorization codes. Codes are single-use, short-lived, and bound to the client and redirect URI they were issued for.
- PKCE support. Applications can require PKCE (S256) to protect public clients against code interception.