Skip to main content
Mint a short-lived access token using OAuth 2.0 Client Credentials, and use it to authenticate calls to the Oleria API. The Oleria API uses the OAuth 2.0 Client Credentials grant: you exchange a client_id and client_secret for a short-lived JWT access token, then pass that token as a Bearer credential on every API call.

Prerequisites

  • Network access from your client to the Oleria authorization server and to the Oleria API base URL for your environment.
  • A secret manager or environment-variable store to hold the client_secret outside of source control.
Treat your client_secret like a password. Never commit it to source control, paste it into chat or tickets, or embed it in client-side code. The secret is shown only when you create or rotate the key. If you lose it or suspect it has leaked, rotate the key immediately.

Get your client credentials

Generate OAuth client credentials from the Oleria web app. The client secret is shown once, on the create (or rotate) success screen. Copy it into your secret manager before you close that screen. You cannot retrieve it again from the key’s details.
1

Open Manage API Keys

Sign in to your Oleria workspace and go to Settings -> Manage API Keys.
2

Create an API key

Select Create API Key. Enter a descriptive name for your integration (for example, BI nightly export or internal access-graph viewer) and select Create.
3

Copy the client secret

The success screen shows your Client ID and Client secret. The secret is concealed until you select Reveal secret or Copy. Store both values in your secret manager before you select Done.
Please copy the client secret now. It will not be shown again. If you lose it, you must rotate or delete this API key.
4

Copy the remaining connection values

Open the new key from the list. The details panel shows the values you need besides the secret:
  • API URL - the base URL for your API calls.
  • Authentication URL - the OAuth token endpoint for your tenant.
  • Audience - the OAuth audience to use when requesting a token.
  • Client ID - your application’s identifier. This matches the value from the create screen.
Use a separate API key for each integration. This makes auditing easier and limits the blast radius if any single credential is compromised.

Token endpoint

The token endpoint URL is tenant-specific and is shown in the Authentication URL field when you create an API key.

Request a token

Send a form-encoded POST to the token endpoint. The body must include grant_type, client_id, and client_secret.
A successful call returns 200 OK with a JSON body:

Use the token

Send the token as a Bearer credential in the Authorization header on every Oleria API request.

Token lifetime and reuse

  • A token is valid for expires_in seconds (typically one hour).
  • Reuse the same token for every API call until it is close to expiry. Minting a new token for every request is wasteful and can hit auth-side rate limits.
  • Cache tokens in memory inside your client and refresh them when they have fewer than 60 seconds of life remaining.
  • Treat access tokens like passwords - keep them in memory only, and avoid writing them to disk or logs.
If you use a standard OAuth 2.0 client library (for example, requests-oauthlib in Python or golang.org/x/oauth2/clientcredentials in Go), token caching and automatic refresh are handled for you.

Rotate or revoke credentials

Rotating a key issues a new client_id and client_secret. The previous credentials stop working immediately.
1

Open the key

Go to Settings -> Manage API Keys and open the key you want to rotate.
2

Rotate credentials

Select Rotate credentials. Confirm the warning that both the client ID and client secret will change.
3

Copy the new values

Copy the new Client ID and Client secret from the success screen into your secret manager, then update every client that used the old credentials. The new secret is not shown again.
Rotate is an immediate cutover of the same key. To avoid dropped requests, create a second API key, roll the new client_id and client_secret out to every client, then delete the old key.

Troubleshooting

Contact us

For questions about API authentication, contact us at support@oleria.com.