API version: 0.3.0

---

# `cron:expire-tokens`

Keeps the stored state of [tokens](/reference/security.md#token-lifecycle) truthful:

- Tokens with state `ACTIVE` whose `expirationDate` has passed become `EXPIRED`.
- Tokens which expired longer ago than the configured `token.tokenDeleteExpiredTokensAutomaticallyInSeconds` (default:
  14 days, `false` disables deleting) are deleted, including their relations.

Takes no arguments or options.

> **ℹ Info**
>
> Expired tokens are already rejected during authentication, independent of this command - it only cleans up. Every
> API instance schedules it every 10 minutes on its own (see
> [Background tasks](/reference/configuration.md#background-tasks)), so it does not need to be invoked manually.

## Help

```bash
php bin/console cron:expire-tokens --help
```

```text
Description:
  Marks expired tokens as expired and deletes tokens which expired long ago.

Usage:
  cron:expire-tokens

Options:
  -h, --help            Display help for the given command. When no command is given display help for the list command
      --silent          Do not output any message
  -q, --quiet           Only errors are displayed. All other output is suppressed
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -e, --env=ENV         The Environment name. [default: "prod"]
      --no-debug        Switch off debug mode.
      --profile         Enables profiling (requires debug).
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
```

## Example

```bash
php bin/console cron:expire-tokens
```

```text
    ▄
  ▄▀ ▀▄  Ember Nexus API
   ▀█▀   v0.3.0, production mode

  Cron

▶ Marked 0 token(s) as expired, deleted 0 token(s).
```

---

Home: [Ember Nexus API docs](/index.md)

Full site map: [llms.txt](/llms.txt)

Previous: [cron:delete-expired-uploads](/command/cron-delete-expired-uploads.md)

Next: [cron:finalize-uploads](/command/cron-finalize-uploads.md)
