mesmer auth

Sign in to the CLI, and get authentication info and tokens.

mesmer auth login

You can sign in to the CLI interactively with mesmer auth login:

$ mesmer auth login some-tenant.mesmerhq.com

─── Sign In
    some-tenant.mesmerhq.com
    Email: william.goodall@mesmerhq.com
    Password [hidden]: [hidden]

 ✓  Authenticated as William Goodall

This will issue an auth token attached to your account, and save it to to auth.yml, in the config directory.

If you've already issued an auth token for your account, you'll be prompted to revoke it and issue a new one:

─── Re-Issue Token
    An auth token is already associated with this account.
    To sign in to the CLI, we'll need to revoke the existing
    token, and generate a new one. Is that OK?
    Revoke existing token? yes

 ✓  Re-issued auth token

If you don't revoke your account token, or if there's a problem issuing one, you'll be logged in to the CLI with a temporary session:

─── Re-Issue Token
    An auth token is already associated with this account.
    To sign in to the CLI, we'll need to revoke the existing
    token, and generate a new one. Is that OK?
    Revoke existing token? no

Auth token could not be issued.
Your session is temporary.

This temporary session will expire after a day, or whenever you log into the web UI with that account.

mesmer auth list

You can view all stored credentials with mesmer auth list:

# Show all stored credentials, checking whether they're valid.
$ mesmer auth list
Tenant                                             Login
some-tenant.mesmerhq.com                           Valid: user1@mesmerhq.com
some-other-tenant.mesmerhq.com                     Valid: user2@mesmerhq.com

# Skip the validity check. This is a little faster.
$ mesmer auth list --no-check
Tenant                                             Login
some-tenant.mesmerhq.com                           [unchecked]
some-other-tenant.mesmerhq.com                     [unchecked]

# Include the tokens themselves in the output. Disabled by default.
$ mesmer auth list --show-tokens

As usual, you can query this information with jq:

# print the first stored auth token
$ mesmer -q '.[].token' auth list --no-check --show-tokens

mesmer auth remove

You can delete a saved credential with mesmer auth remove:

# What do we have?
$ mesmer auth list --no-check
Tenant                                             Login
some-tenant.mesmerhq.com                           [unchecked]
thing-to-remove.mesmerhq.com                       [unchecked]

# Remove a credential
$ mesmer auth remove thing-to-remove.mesmerhq.com

# ...and it's gone.
$ mesmer auth list --no-check
Tenant                                             Login
some-tenant.mesmerhq.com                           [unchecked]