How does the client authenticate me?

The client can be used in interactive and non-interactive mode, depending on the operation being monitored by a human or not, and of course by your choice.

In interactive mode (which is the default) the client will check if it has a valid authorization and, if not, will open for you a browser window so that you can log in with your credentials. After a successful login, the client will securely store an authorization token in your home folder, so that you will not need to log in for a certain amount of time. Depending on your configuration, this can vary from hours to days, but by default, a token obtained in this way will last 24 hours.

In non-interactive mode, used on servers or CI/CD platforms, you will need to generate a token on the dashboard and then store it as a file on the local file system. When you will launch the client you will have to specify where the token is stored so that the client can authenticate on your behalf.

$ java -jar /tmp/meterian-cli.jar --interactive=false --auth-file=/tmp/tokens/mytoken.json

The client also reads the environment variable METERIAN_API_TOKEN which can be preloaded with the value of the token, as visible from the dashboard page, in the UUID format "01234567-890a-bcde-f012-34567890abc"). We suggest to export this variable in your login script or, if running on a CI/CD platform, using the secrets configuration available there.

In your login script:
export METERIAN_API_TOKEN=1234fd34-..."

During normal operation:
$ java -jar /tmp/meterian-cli.jar 

For detailed information please see the instructions section in your administration page.

Last updated