Skip to content

cub auth status

cub auth status

Check whether the current session is authenticated

Synopsis

Check whether the current session is authenticated.

Unlike 'cub context get', this command contacts the server to verify that the access token is still valid. It loads the token for the active context, checks its expiration locally, and then calls the server's /me endpoint to confirm the token is accepted.

An expired session is renewed when the context can renew it without a person: a context that authenticates with a private key, such as a service account's, signs in again with the key, and one signed in through the browser uses the refresh token stored with it. Every command does the same when the server rejects an expired token, so this one only reports it. The renewed credentials are saved to the context, as 'cub auth login' saves them.

If the session is not authenticated and cannot be renewed, the command exits with a non-zero status and prints instructions to run 'cub auth login'. For a context that authenticates with a private key, 'cub auth login' signs in from the key with no browser, so an agent can run it. Otherwise re-authentication is an interactive browser sign-in, which an agent cannot complete on the user's behalf, so it must ask the user to run 'cub auth login'.

It also compares the client and server versions. Pre-1.0, a change in the second version number is not backward compatible, so a cub older than the server exits non-zero telling you to run 'cub upgrade', and a cub newer than the server prints a warning.

Examples:

  # Check authentication status against the server in the active context
  cub auth status
cub auth status [flags]

Options

  -h, --help   help for status

Options inherited from parent commands

      --context string   The context to use for this command
      --debug            Debug output

SEE ALSO