Skip to main content
No Result Found

Authenticate your Test Runs

Learn how to authenticate your Cypress test runs

You can authenticate your test runs in three ways:

  1. Setting the environment variables
  2. Using the CLI params
  3. Mentioning the auth credentials in the browserstack.json

If you use more than one option to pass your auth credentials, we use the following order of precedence to determine which auth credentials to use:

CLI arguments > Environment variables > Options set in browserstack.json

Setting the environment variables

You can set the following environment variables while using the CLI. This will override the auth credentials that you use in your browserstack.json file.

Env variable Accepted values
BROWSERSTACK_USERNAME Your BrowserStack username
BROWSERSTACK_ACCESS_KEY Your BrowserStack access key

Using the CLI

You can use the following args while running the tests using the run command:

Arg Shorthand Accepted values
--username -u Your BrowserStack username
--key -k Your BrowserStack access key

For example:

Command Line
browserstack-cypress run --sync --username YOUR_USERNAME --key YOUR_ACCESS_KEY

Using browserstack.json

You can use the auth option to specify your username and access keys. You can find them in your Automate dashboard. This will override the auth credentials that you set in environment variables as well as the ones that you mention in browserstack.json file.

Here are the options that we support in auth:

Arg Accepted values
username Your BrowserStack username
access_key Your BrowserStack access key

For example:

browserstack.json
{
  ...
  "auth": {
    "username": "YOUR_USERNAME",
    "access_key": "YOUR_ACCESS_KEY"
  }
  ...
}

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

Is this page helping you?

Yes
No

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!

Talk to an Expert
Download Copy Check Circle