You'll need to authenticate in order to use k6 Cloud, whether it's for streaming results or running tests in the cloud. Your Auth Token enables the interaction with k6 Cloud using the k6 CLI or through the REST API. Get your Auth Token.
Below are some examples on how to utilize the token to authenticate.
Google/GitHub Single Sign-On Users
For Single Sign-On (SSO) users, k6 login cloud requires a k6 Cloud account email and password. You will need to create a password using Forgot Password, or you'll instead need to get your API authentication token from the app and supply that explicitly: k6 login cloud --token YOUR_API_AUTH_TOKEN.See below for more information.
If you're running k6 in a Docker container you'll need to make sure that the k6 config file where the k6 Cloud API authentication information is stored to is persisted via a Docker volume to the host machine, using the -c/--config PATH/TO/CONFIG_FILE CLI flag, e.g. docker run --rm -i -v /path/on-host:/path/in-container/ grafana/k6 login cloud -c /path/in-container/config.json.
Integrating with CI
If you are integrating k6 into your CI pipeline, we recommend using one of the token methods to authenticate and not exposing your username/password within your CI configuration files or as variables.
You can forego using a token and use your k6 Cloud email/password credentials by entering the following command into your terminal:
This will login to your account, fetch (and create if necessary) your k6 Cloud API authentication token, and save it to a k6 configuration file.
If you're a Google/GitHub Single Sign-On (SSO) user, or if you have a use case where using your k6 Cloud account credentials is not appropriate, you can choose to enter your k6 Cloud API authentication token directly. You do this by entering the following command into your terminal:
You can also authenticate with your k6 Cloud API authentication token via environment variables. Make sure the K6_CLOUD_TOKEN has been set to your k6 Cloud API authentication token, and k6 will pick it up when executing.
You can also directly add your k6 Cloud API authentication token to a configuration file:
or by specifying the -c/--config PATH/TO/CONFIG_FILE CLI flag.
When your k6 Cloud API authentication token has been added to the config file, it should look something like this (removing any other config options from the file):