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
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
â–¶ SHOW VALUESContains the list of authentication configurations.
-
authConfigs Array
â–¶ SHOW VALUESList of authentication configuration objects.
-
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) orform_2(form-based auth). -
authData Object
The authentication credentials. The fields vary based on the
type(seeAuthConfigBasicDataorAuthConfigFormData).
-
-
Create authentication config
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
basicfor HTTP basic authentication orform_2for form-based authentication. -
authData* Object
â–¶ SHOW VALUESThe credentials and selectors required for the chosen authentication type.
-
username String
The username credential. Required for both
basicandform_2types. -
password String
The password credential. Required for both
basicandform_2types. -
url String
The login page URL. Required for
form_2type only. -
usernameSelector String
The CSS selector for the username input field. Required for
form_2type only. -
passwordSelector String
The CSS selector for the password input field. Required for
form_2type only. -
submitSelector String
The CSS selector for the form submit button. Required for
form_2type 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
â–¶ SHOW VALUESThe created authentication configuration object.
-
id Integer
The unique ID of the newly created authentication configuration.
-
name String
The name of the authentication configuration.
-
type String
The authentication type (
basicorform_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_2type. -
usernameSelector String
The CSS selector for the username field. Present only for
form_2type. -
passwordSelector String
The CSS selector for the password field. Present only for
form_2type. -
submitSelector String
The CSS selector for the submit button. Present only for
form_2type.
-
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.