> ## Documentation Index
> Fetch the complete documentation index at: https://namespace.so/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 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

```bash theme={null}
nsc auth check-login [--duration duration]
```

### Examples

#### Logged in:

```bash theme={null}
nsc auth check-login
```

```text nocopy Output theme={null}
# Exit code 0
```

#### Not logged in:

```bash theme={null}
nsc auth check-login
```

```text nocopy Output theme={null}
Failed:
Jul  8 11:48:14.098 UTC nsc.fetch-token waited=3us
not logged in

please run `nsc login`

# Exit code 1
```

## Options

<h3 id="--duration">
  \--duration
</h3>

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.
