Skip to main content
AI agents are now live in Website Scanner! Enter your URL and fix website issues 3x faster with AI. Explore now!
No Result Found
Connect & Get help from fellow developers on our Discord community. Ask the CommunityAsk the Community

Authentication configurations

Learn how to create and retrieve authentication configurations for the Website Scanner API.

Authentication configurations let you securely store and manage credentials for websites that require authentication during scanning. Use these endpoints to create new authentication configs or retrieve existing ones for your scans.

Get authentication configs

GET /api/v1/scanner/auth_configs

Use this endpoint to retrieve all authentication configurations associated with your account. This helps you manage credentials and review existing configs before running a scan.

Request parameters

Request

curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
  https://api-scanner.browserstack.com/api/v1/scanner/auth_configs
  • No parameter required.

Response attributes 200 application/json

Response

{
   "success":true,
   "data":{
      "authConfigs":[
         {
            "id":11,
            "name":"primary_basic_auth",
            "type":"basic",
            "authData":{
               "username":"api_user_primary",
               "password":"P@ssw0rd_Example1"
            }
         },
         {
            "id":15,
            "name":"login_form_auth",
            "type":"form_2",
            "authData":{
               "url":"https://example-login.com",
               "username":"form_user",
               "password":"P@ssw0rd_FormAuth",
               "usernameSelector":"#username-input",
               "passwordSelector":"#password-input",
               "submitSelector":"#login-button"
            }
         },
         {
            "id":10,
            "name":"staging_basic_auth",
            "type":"basic",
            "authData":{
               "username":"staging_user",
               "password":"P@ssw0rd_Staging"
            }
         }
      ]
   }
}
  • success Boolean

    Indicates whether the request was successful.

  • data Object

    Contains the list of authentication configurations.

    â–¶ SHOW VALUES
    • authConfigs Array

      List of authentication configuration objects.

      â–¶ SHOW VALUES
      • id Integer

        The unique ID of the authentication configuration.

      • name String

        The name of the authentication configuration.

      • type String

        The authentication type. Possible values are basic (HTTP basic auth) or form_2 (form-based auth).

      • authData Object

        The authentication credentials. The fields vary based on the type (see AuthConfigBasicData or AuthConfigFormData).

Create authentication config

POST /api/v1/scanner/auth_configs

Use this endpoint to create a new authentication configuration for your website scans. You can create configs for both basic and form-based authentication.

Request parameters

Request (Form-based authentication)

curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
  -X POST https://api-scanner.browserstack.com/api/v1/scanner/auth_configs \
  -H 'Content-Type: application/json' \
  -d '{
    "authData": {
      "password": "user",
      "passwordSelector": "#password-field",
      "submitSelector": "#submit-btn",
      "url": "https://example-login.com",
      "username": "somo",
      "usernameSelector": "#username-field"
    },
    "name": "sample_auth_config",
    "type": "form_2"
  }'

Request (Basic authentication)

{:._code}
```bash
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
  -X POST https://api-scanner.browserstack.com/api/v1/scanner/auth_configs \
  -H 'Content-Type: application/json' \
  -d '{
    "authData": {
      "password": "user",
      "username": "somo"
    },
    "name": "sample_auth_config_basic",
    "type": "basic"
  }'
  • name* String

    A descriptive name for the authentication configuration.

  • type* String

    The authentication type. Use basic for HTTP basic authentication or form_2 for form-based authentication.

  • authData* Object

    The credentials and selectors required for the chosen authentication type.

    â–¶ SHOW VALUES
    • username String

      The username credential. Required for both basic and form_2 types.

    • password String

      The password credential. Required for both basic and form_2 types.

    • url String

      The login page URL. Required for form_2 type only.

    • usernameSelector String

      The CSS selector for the username input field. Required for form_2 type only.

    • passwordSelector String

      The CSS selector for the password input field. Required for form_2 type only.

    • submitSelector String

      The CSS selector for the form submit button. Required for form_2 type only.

Response attributes 200 application/json

Response (Form-based authentication)

{
   "success":true,
   "data":{
      "id":16,
      "name":"sample_auth_config",
      "type":"form_2",
      "username":"user",
      "password":"password",
      "url":"https://google.com",
      "usernameSelector":"somo",
      "passwordSelector":"user",
      "submitSelector":"ack"
   }
}

Response (Basic authentication)

{
   "success":true,
   "data":{
      "id":18,
      "name":"sample_auth_config_basic",
      "type":"basic",
      "username":"somo",
      "password":"user"
   }
}
  • success Boolean

    Indicates whether the request was successful.

  • data Object

    The created authentication configuration object.

    â–¶ SHOW VALUES
    • id Integer

      The unique ID of the newly created authentication configuration.

    • name String

      The name of the authentication configuration.

    • type String

      The authentication type (basic or form_2).

    • username String

      The username stored in the authentication configuration.

    • password String

      The password stored in the authentication configuration.

    • url String

      The login page URL. Present only for form_2 type.

    • usernameSelector String

      The CSS selector for the username field. Present only for form_2 type.

    • passwordSelector String

      The CSS selector for the password field. Present only for form_2 type.

    • submitSelector String

      The CSS selector for the submit button. Present only for form_2 type.

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback

Download Copy Check Circle