Generate Catalyst CLI Token and Configure it in Travis CI

Let’s generate a Catalyst CLI token.

  1. Open your system’s terminal and execute the following Catalyst CLI command:
copy
$
catalyst token:generate

This will initiate the token generation process. The CLI will display a URL that you can visit from any device.

react_cicd_catalyst_generate_token

  1. Navigate to this URL and enter the device verification code that was displayed in the CLI. Click Verify. The code will only be valid for five minutes.

react_cicd_verify_zoho

Once your device’s CLI is verified, the token will be generated and displayed in your CLI.

react_cicd_token_generated


Configure the CLI Token in Travis CI

We generally use the CLI token by specifying it as an option with the CLI command. However, we have not used the –token option in the travis.yml file following the CLI commands, because Travis CI enables you to add the CLI token as an environment variable. Adding the token as an environment variable ensures complete security of access to the Catalyst CLI. It prevents you from openly disclosing the token in the travis.yml file.

Let’s now add the token in Travis in the following way:

  1. Open the Travis CI console and click Cat.ly’s repository under My Repositories. react_cicd_travis_catly_repo_select

  2. Click More options, then Settings. react_cicd_travis_catly_repo_display

  3. Add the CLI token as an environment variable by entering the name as “CATALYST_TOKEN” and the token’s value under value. You can select a specific branch of your repo, if needed. Click Add. react_cicd_travis_catly_token_generate


Travis will now automatically use this token for authorization whenever it executes a CLI command.

Note: If you revoke the token from the Catalyst CLI or generate a different token for your Catalyst user account, you must update the details in Travis CI.

Last Updated 2023-08-04 20:20:24 +0530 +0530

RELATED LINKS

CLI Tokens CLI Options