OAuth2 client credentials

I/O and network Pure
OAuth2 client credentials
Token URL
Credentials(HTTP credentials)
Client ID
Client secret
Scope
Audience
Extra parameters

Description

Pure function: fetches an OAuth2 access token via the client credentials grant and returns a credentials object that can be wired into http-request.

When to use

Use OAuth2 client credentials to authenticate machine-to-machine API calls that require an OAuth2 bearer token. Because it is a pure node, the token is fetched lazily when credentials is consumed by HTTP request. Wire the output directly into http-request.credentials — the node handles the Authorization header automatically. Provide scope and audience only when the target authorization server requires them.

Pins

Input pins

Pin Type Default Notes
Token URL string The token endpoint URL of the authorization server.
Client ID string The OAuth2 client ID issued by the authorization server.
Client secret string The OAuth2 client secret. Store sensitive values as pipeline variables rather than hardcoding them.
Scope string Space-separated list of requested scopes. Leave empty if the authorization server does not require a scope.
Audience string Optional audience parameter required by some authorization servers (e.g. Auth0).
Extra parameters map<string,string> Optional additional key/value pairs to include in the token request body.

Output pins

Pin Type Notes
Credentials HTTP credentials A credentials object carrying the access token. Wire directly into `http-request.credentials`.

Example

Call a protected API using a client credentials token. Set the Token URL, Client ID, and Client secret inputs on OAuth2 client credentials, then wire the Credentials output into the Credentials input of HTTP request. The token is fetched once per pipeline execution on demand. On the Success execution output, log a confirmation message.

See also