Skip to main content

cron:expire-tokens

Keeps the stored state of tokens 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.

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), so it does not need to be invoked manually.

Help

php bin/console cron:expire-tokens --help
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

php bin/console cron:expire-tokens
    ▄
  ▄▀ ▀▄  Ember Nexus API
   ▀█▀   v0.3.0, production mode

  Cron

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