There are two ways to authenticate the with Garnet using the CLI.

Method 1: Interactive Login

This method is recommended for cases where a human is authenticating with Garnet.

Retrieve the Garnet auth token

You can authenticate with Garnet by supplying your Garnet access token. The access token can be retrieved from your Garnet dashboard under your profile section.


You can use the login command in the CLI to authenticate to Garnet.

$ garnet login <token>

When logging in for the first time, a configuration file called garnet.json will be created in your home directory (default:$HOME/.garnet/garnet.json). This file will contain your Garnet token and Tenant ID, which are used to authenticate requests to the Garnet API.

Method 2: Service Keys

This method is recommended for cases where a machine (eg. a server) is authenticating with Garnet. This is the recommended authentication method for using Garnet in external platforms such as CI tools and cloud platforms. Service keys allow the Garnet CLI to fetch the scoped configuration without using the interactive method of garnet login. You can use the garnet run command with a service key by specifying the --service-key flag.

garnet run --service-key=<your-service-key> -- <command>

You can read more on service keys on this dedicated guide.