Auth
Say once how the API authenticates, and CLEM adds the credentials to every request: Basic, a Bearer token, an API key, or OAuth 2.0 with tokens it gets and renews for you.
Example flow
examples/Help/auth.clem.json: Basic, Bearer and an API key against httpbin.org, which echoes back what it received.
Flow auth and request auth
- The flow's auth: Flow Settings (the gear in the title bar) → Auth for every request. Set it once for an API where every call authenticates the same way.
- A request's auth: its Auth tab. Inherit (the default) uses the flow's auth, No auth sends none, and any other type is the request's own.


Every field takes $vars, so credentials can live in an environment or, better, a secret. The log and reports mask them. A header the request sets itself (Authorization…) wins over its auth. A $var in an auth field that has no value is sent as written, and the log warns: Auth (Basic): $password has no value, so it was sent as written. Check the variable's name, or set the secret's value.
The types
| Type | Fields | Sends |
|---|---|---|
| Basic | Username, password | Authorization: Basic base64(user:password) |
| Bearer token | Token, prefix (Bearer) | Authorization: Bearer <token> |
| API key | Name, value, in (header or query) | X-Api-Key: … or ?api_key=… |
| OAuth 2.0 | Grant, token URL, client id / secret, scope… | Authorization: Bearer <access token> (or ?access_token=) |
The common pattern, a login request that returns a token, is in the tutorial: extract $token from the login's response, and set the flow's auth to Bearer token $token.
OAuth 2.0
CLEM gets the token before the first request that needs it, adds it, renews it when it expires (with the refresh token when there is one) and, when the server answers 401 to a saved token, gets a new one and sends the request once more.
| Grant | For |
|---|---|
| Client credentials | Service-to-service APIs: client id and secret only. |
| Password | A user's name and password, for APIs that still allow it. |
| Authorization code (with PKCE) | Signing in as a user: CLEM opens a sign-in window the first time. |
Tokens stay in memory until the app closes, never in the flow. Forget tokens in the auth settings signs in again.
Exported flows get their own tokens when they run. They can't open a sign-in window, so for the authorization code grant give them a refresh token (for example $refreshToken, set with --set or an environment).
From imports
Postman, Bruno, OpenAPI and cURL imports bring their auth along: a collection's auth becomes the flow's, a folder's or a request's own goes to the request's Auth tab, and curl -u / --oauth2-bearer set Basic / Bearer. Import.