Skip to content
↑↓ move↵ openesc close

Authorization

Credentials of the contract

The credentials that the securitySchemes of a contract ask for, where to fill them in the environment and how Luvin sends each one in workflows.

3 min read

A contract (OpenAPI) says in its securitySchemes how the API is protected. In workflows, Luvin reads them and asks you for one value per scheme in the Credentials section of the environment. This is the default for every API of a workflow: you do not set anything else.

A contract declares:

shop.openapi.yaml
components:
securitySchemes:
shopKey:
type: apiKey
in: header
name: X-Shop-Key
shopBearer:
type: http
scheme: bearer

In the environment, Credentials shows one field for shopKey (type apiKey · header "X-Shop-Key") and one for shopBearer (type bearer). With k-123 and abc123 filled in, a protected step goes out with:

X-Shop-Key: k-123
Authorization: Bearer abc123
  1. Open the environment of the collection.
  2. In Credentials, find the scheme. Each field shows the scheme name, its type, and the API (source) it belongs to. If two APIs use the same scheme name, the name starts with the API: shop · shopKey.
  3. Paste the value, or write a secret such as {{apiKey}}.
  4. Check the counter, for example 1/2 filled. It turns green when all are filled.

An environment open, with its base URLs, credentials, variables and secrets

From the contract documentation, Authorize opens the environment. From a workflow card set to From the contract, Open the environment does. Values are stored encrypted on your computer, never in the environment file.

Scheme in the contract What you paste What Luvin sends
apiKey, in header The key The header named in the contract, with the key.
apiKey, in query The key The query parameter named in the contract.
apiKey, in cookie The key A cookie named in the contract.
http bearer The token Authorization: Bearer <token> (not repeated if you already wrote Bearer ).
http basic user:password Authorization: Basic <base64> (a value that already starts with Basic is sent as is).
oauth2 An access token Authorization: Bearer <token>.
openIdConnect An access token Authorization: Bearer <token>.

Luvin does not request the OAuth 2.0 token for you here: you paste one. To have Luvin request and renew it, set OAuth 2.0 in the workflow’s Authorization tab. See OAuth 2.0.

Any other scheme (for example mutualTLS) shows the hint Unsupported security type; it will be ignored. Luvin sends nothing for it. Use the workflow’s Authorization tab or an input if the API needs something else.

The section says The contracts do not declare securitySchemes. If authentication goes in headers or in a workflow step, it is taken from the inputs. Then the credentials come from the inputs of the workflow, or from an authorization you set in the workflow’s tab.

  • If an operation lists several alternatives, Luvin uses the first one that is not empty. The schemes of one alternative are all sent.
  • Cases that test a call without credentials go without any of these.
  • They apply against the Real API. In simulation no call leaves your computer.
  • When you choose any other option in the workflow’s Authorization tab, the steps of that API stop using these credentials.