Documentation Index

Fetch the complete documentation index at: https://docs.supermetrics.com/llms.txt

Use this file to discover all available pages before exploring further.

Basic authentication

Prev Next

HTTP Basic authentication is a simple authentication scheme built into the HTTP protocol. The user provides a username and password, which are sent with each request to the data source API.

To configure Basic authentication, add an authentication component with type: "basic" and collect the username and password through user inputs. Supermetrics uses these values to authenticate your requests with HTTP Basic authentication automatically – you don't need to build the Authorization header yourself.

Prerequisites for configuring Basic authentication

Basic authentication only requires the credentials the data source expects – typically a username and password. No developer application or callback URL is needed.

Template Basic authentication configuration

Below you can find a template configuration that you can fill in with your own information for an easier start:

{
  "authentication": {
    "type": "basic",
    "description": "[Description shown to users during the authentication flow]",
    "userInputs": [
      {
        "id": "username",
        "label": "Username",
        "type": "text"
      },
      {
        "id": "password",
        "label": "Password",
        "type": "password"
      }
    ]
  }
}

Configuring Basic authentication

Basic authentication is configured with type: "basic" and a userInputs array. For the credentials to be recognized and applied as HTTP Basic authentication, define user inputs with the IDs username and password.

  • Use the text type for the username so the value is visible as the user types it.
  • Use the password type for the password so the value is hidden.

You can define additional inputs if the connection requires them – for example, an account name used to label the connection:

{
  "authentication": {
    "type": "basic",
    "description": "This is a description for HTTP basic authentication",
    "userInputs": [
      {
        "id": "account_name",
        "label": "Account name",
        "type": "text"
      },
      {
        "id": "username",
        "label": "Username",
        "type": "text"
      },
      {
        "id": "password",
        "label": "Password",
        "type": "password"
      }
    ]
  }
}

Storing inputted values in Data source user

To store the values inputted by the user and use them later – for example, to label the connection – define a Data source user component.

Below you can find an example that stores a generated unique ID and uses the account name as the label:

{
  "dataSourceUser": {
    "userInfo": {
      "id": {
        "source": "static",
        "value": "{{ identity() }}"
      },
      "label": {
        "source": "userInput",
        "value": "account_name"
      }
    }
  }
}

Using Basic authentication in requests

When the authentication type is basic, Supermetrics automatically adds the HTTP Basic Authorization header to your requests using the username and password values. You don't need to add any authentication header to your request objects.

Note

If you need more control over how the credentials are sent – for example, when only some requests should be authenticated, or when the API expects the credentials in a non-standard header – use API key authentication with type: "user_input" and build the header yourself with a placeholder such as Basic {{base64(inputs.username,':',inputs.password)}}.