Basic auth and custom HTTP headers

📘

Using authorization headers

If a given request already has authorization headers, mabl does not apply any additional authorization headers to it. Basic authorization or adding a custom HTTP header with authorization only works on requests that do not contain authorization headers already.

Basic auth

If your test environment is protected by HTTP basic auth, you can configure mabl tests to run with basic auth credentials. Follow these steps to configure basic auth:

Add basic auth credentials to your workspace

  1. Click on Configuration in the left-hand navigation menu.
  2. Select the Credentials tab.
  3. Click the + New credentials button. The Add Credentials page will appear.
2386
  1. Add the credential name, description (optional), username, and password.
  2. Click the Save button.

Credentials can be associated and used in plan runs and ad hoc test runs.

Add basic auth credentials to your plan

You can configure a plan to enable the HTTP basic auth by taking the following steps:

  1. Navigate to the Plan Details page of the plan you'd like to configure.
  2. Click on the pencil icon. The Plan Edit page will open.
  3. Scroll to the Device settings section.
  4. Click on Advanced options to open the dropdown menu.
  5. Toggle on HTTP basic auth required.
1097
  1. Select your credentials from the dropdown that appears.
1088
  1. Click the Save button at the bottom of the page.

Add basic auth credentials to an ad hoc test run

Ad hoc test runs (local and cloud) can also be configured to use basic auth credentials in the Ad hoc run panel:

423

📘

Using basic auth and application logins

It is possible to use both HTTP basic auth and application logins at the same time. If basic auth credentials are specified, these will be sent at the HTTP layer with all requests to your test site. If application credentials are also specified, mabl will attempt to login to your application by locating a login form and entering the given credentials.

Adding custom HTTP headers

You can configure mabl to pass custom HTTP headers with each request in a plan run. These custom headers may be used for authentication or to exercise some specific behavior of your application.

To specify custom HTTP headers for a plan, take the following steps:

  1. Navigating to the Plans section.
  2. Choose a specific plan.
  3. Click on the pencil icon. The Edit Plan page will open.
  4. Scroll to the Device settings section.
  5. Click on Advanced options to open the dropdown menu.
  6. Toggle on "Send custom HTTP headers."
  7. Add one or more header key-value pairs.
576
  1. Click the Save plan button at the bottom of the page.

Adding custom HTTP headers to local test runs

For information on configuring custom HTTP headers for local ad hoc test runs, click here.

📘

Limitation

Custom HTTP headers are only supported for plan runs in the cloud. Ad hoc cloud runs of a single test cannot be configured to use custom HTTP headers.