# CLI Login

## 1. If running tests in CI env. <a href="#id-1-if-running-test-in-ci" id="id-1-if-running-test-in-ci"></a>

a. Go to your accounts page

<figure><img src="/files/5OkzmFZ4IA33WR8ykXzJ" alt=""><figcaption></figcaption></figure>

b. Click to create a new CLI token

<figure><img src="/files/KIjDTICp9oDdaWtKzJWJ" alt=""><figcaption></figcaption></figure>

c. Copy the newly generated CLI token and add it as a env var with key "HT\_CLI\_REFRESH\_TOKEN"

<figure><img src="/files/V91DYiK92y1nPSKpRlfk" alt=""><figcaption></figcaption></figure>

## 2. If running tests locally. <a href="#id-2-if-running-test-on-local" id="id-2-if-running-test-on-local"></a>

a. Once the test is started, cli will prompt the user to login by opening the dashboard url.

b. If cli is unable to open the url then it will log the url, user can manually click on the link to open dashboard.

<figure><img src="/files/rBxrrljrbic7F3OzPGBL" alt=""><figcaption></figcaption></figure>

c. User can login with SSO or email password option.

d. Once login is successful the user is redirected to accounts page where the cli token is generated if it doesn't exist and the test execution will resume.

<figure><img src="/files/nwtpmTjvccxCszxQ4uJV" alt=""><figcaption></figcaption></figure>

e. If the cli session times out then the process needs to be repeated. Once the token is saved in local, the same token will be reused for future test runs.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-v2.hypertest.co/user-guides/node.js-sdk/cli-login.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
