Skip to main content

token:revoke

Revokes active authentication tokens, optionally restricted by user, group, or issue date. Run without any filter options, it targets every currently active token.

Filters (combine as needed; a token must match all given filters to be revoked):

  • -u, --user= - only tokens owned by a given user, identified by UUID (takes precedence) or the configured unique identifier.
  • -g, --group= - only tokens owned by users belonging to a given group, identified by UUID.
  • -b, --issued-before= / -a, --issued-after= - only tokens issued before/after a given point in time, formatted YYYY-MM-DD HH:MM in UTC. Combining both requires --issued-after to be earlier than --issued-before, otherwise the command errors out.
  • --issued-with-expiration-date / --issued-without-expiration-date - only tokens that do (or don’t) have an explicit expiration date. These two are mutually exclusive.

Other options:

  • -f, --force - skips the interactive confirmation prompt before revoking.
  • --dry-run - lists every token that would be affected, without revoking anything and without prompting.
  • -l, --list-all-affected-tokens - shows the full list of affected tokens in the confirmation table. Without it, the table is capped at the first 10 tokens once more than 10 would match (the full set is still revoked, only the preview is capped).

If no tokens match, the command exits successfully without asking for confirmation. Revoking marks each matching token as revoked in the graph database and expires its corresponding Redis session key.

Help

php bin/console token:revoke --help
Description:
  Revoke tokens.

Usage:
  token:revoke [options]

Options:
  -f, --force|--no-force                                        If enabled, command will not ask for manual confirmation.
      --dry-run|--no-dry-run                                    Does not apply revocation. Also lists all tokens which would be affected.
  -l, --list-all-affected-tokens|--no-list-all-affected-tokens  Lists all tokens.
  -u, --user=USER                                               Token revocation is only applied to an given user. User can be specified by its UUID (takes precedent) or its identifier.
  -g, --group=GROUP                                             Token revocation is only applied to users of given group. Group must be specified by its UUID.
  -b, --issued-before=ISSUED-BEFORE                             Token revocation is only applied to tokens issued before a given point in time. Datetime must be in the format "YYYY-MM-DD HH:MM" (UTC).
  -a, --issued-after=ISSUED-AFTER                               Token revocation is only applied to tokens issued after a given point in time. Datetime must be in the format "YYYY-MM-DD HH:MM" (UTC).
      --issued-without-expiration-date                          Token revocation is only applied to tokens with no explicit expiration date.
      --issued-with-expiration-date                             Token revocation is only applied to tokens with explicit expiration date set.
  -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 token:revoke -f
    ▄
  ▄▀ ▀▄  Ember Nexus API
   ▀█▀   v0.3.0, production mode

  Token Revocation

  222 tokens are affected by revocation. First 10 are shown:

  Token UUID                             User UUID                              User identifier                                         Created              Expires on 
  02IiNr0EPf9nVLAEnjD3nZ0XfHPaVQgPo19YJ  02IiNr0EPf9nVLAdBH0o4W0bpXcdXuf59iUqU  user@delete-owns-relation.etag.general.localhost.dev    2020-01-01 00:00:00  -
  02IiNr0EPf9nVLAXnGKTDcDNhcqytOo2SreD6  02IiNr0EPf9nVLAgFpWxB6gT6uFZMQJnapGyH  user@update-node.etag.general.localhost.dev             2020-01-01 00:00:00  -
  02IiNr0EPf9nVLAjizl3zbxLr6oAGFKwNLIVW  02IiNr0GOoKiPMLdSprUloV0A5zH5s4LSrSw0  user@issuedBefore.revoke.token.command.localhost.dev    2020-01-01 00:00:00  -
  02IiNr0EPf9nVLAt81LGJLTAzj4HDHH8iVZKO  02IiNr0EPf9nVLAG6umdSOYm5uLDhREEaNlwM  user@maximum.etag.general.localhost.dev                 2020-01-01 00:00:00  -
  02IiNr0EPf9nVLAw3BsoQetQRhgwDOLc9DIT7  02IiNr0EPf9nVLB9JuUFr6Ccd7frvta7QW942  user@update-owns-relation.etag.general.localhost.dev    2020-01-01 00:00:00  -
  02IiNr0EPf9nVLAxbMe37eZqinvaiEq15cse3  02IiNr0EPf9nVLC5IWN7C5UTSZNuNYlEQoZc5  user@create-node.etag.general.localhost.dev             2020-01-01 00:00:00  -
  02IiNr0EPf9nVLB18FWBXVRCbI4qDALa69pCO  02IiNr0EPf9nVLC0r6lneBmhmobVh2qgBbbS7  user@if-match.general.localhost.dev                     2020-01-01 00:00:00  -
  02IiNr0EPf9nVLBRjUtnkpsBkHmXEM80iKXWK  02IiNr0EPf9nVLBAM1l5qzgHDx2xueHYkGYfB  user@if-none-match.general.localhost.dev                2020-01-01 00:00:00  -
  02IiNr0EPf9nVLBRlLCh5EtFBP0Nn5PiogUGQ  02IiNr0EPf9nVLC9k5j1nvc85EKYIJ6NakyTK  user@create-owns-relation.etag.general.localhost.dev    2020-01-01 00:00:00  -
  02IiNr0EPf9nVLBTFpP4MVqyuND8tIRgIVhG7  02IiNr0EPf9nVLCAVGwQWlSseBVemn87vd4QZ  user@create-normal-relation.etag.general.localhost.dev  2020-01-01 00:00:00  -

  Revoking tokens...

▶ Successfully revoked tokens.