nsc auth check-login

Return a successful exit code if the caller is still authenticated to Namespace.

nsc auth check-login verifies that you are currently authenticated and that your session is still valid. When everything is valid, it exits with code 0. When there is a problem it will exit with a non-zero exit code.

This is useful for scripts that need to check for a valid login.

Usage

nsc auth check-login [--duration duration]

Examples

Logged in:

$ nsc auth check-login
# Exit code 0

Not logged in:

$ nsc auth check-login
Failed:
Jul  8 11:48:14.098 UTC nsc.fetch-token waited=3us
not logged in
 
please run `nsc login`
 
# Exit code 1

Options

--duration

Checks whether the current session can issue credentials valid for at least this duration. Defaults to 5m.

Fails if the current session is expired, revoked, or too close to expiration.

Last updated