Skip to main content

Authentication


Authenticate your Cypress test runs in the following ways -

  1. Set up the environment variables. (or)
  2. Utilizing the CLI params. (or)
  3. Mention yourusername and access key in the lambdatest-config.json.

Warning: We use the following order of precedence to determine which auth credentials to use if you use more than one option to pass your auth credentials:

CLI arguments > Options set in lambdatest-config.json > Environment variables

Utilizing CLI Params:


The following args can be used while running tests using the run command.

ArgShorthandAccepted values
--username-uYour LambdaTest username
--key-kYour LambdaTest access key

For example -

 lambdatest-cypress run --username YOUR_USERNAME --key YOUR_ACCESS_KEY

Using lambdatest-config.json:


The auth option will help you in specifying your username and access key. You can find your username and access key in the LambdaTest Automation Dashboard. Both, the auth credentials set in environment variables and the ones mentioned in the lambdatest-config.json file will get overridden.

cmd

The options supported in the auth are as follows:

ArgAccepted values
usernameYour LambdaTest username
access_keyYour LambdaTest access key

For example -

"lambdatest_auth": {
"username": "<your username>",
"access_key": "<your access key>"
},

Setup the Environment Variables:


While utilizing the CLI params, you can set up the following environment variables.

Env variableAccepted values
LT_USERNAMEYour LambdaTest username
LT_ACCESS_KEYYour LambdaTest access key

Or you can also set environment variables using following commands:

  • For Linux/macOS:
export LT_USERNAME="YOUR_USERNAME" export LT_ACCESS_KEY="YOUR ACCESS KEY"
  • For Windows:
set LT_USERNAME="YOUR_USERNAME" set LT_ACCESS_KEY="YOUR ACCESS KEY"

Note - By doing so, the auth credentials you use in your lambdatest-config.json file will get overridden only if these options are not provided in lambdatest-config.json.