token:create
Creates a new authentication token for a user directly from the CLI, without going through an HTTP login request - useful for scripting, seeding test accounts, or bootstrapping access when no token exists yet.
Both arguments are required: identifier is the user’s unique identifier (typically their email, depending on the instance’s configured unique identifier field) or the user’s UUID directly, and password is that user’s plaintext password. The command looks up the user, verifies the password against the stored hash, and on success prints a newly generated token.
The command exits with a failure status (without creating a token) if the identifier can’t be resolved to exactly one user, if the user has no password set, or if the password doesn’t match.
Help
php bin/console token:create --helpDescription: Creates a new token for an user. Usage: token:create <identifier> <password> Arguments: identifier Unique identifier of the user (email) or the user's UUID password Password of the user 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 token:create token-create-test@localhost.dev 1234▄ ▄▀ ▀▄ Ember Nexus API ▀█▀ v0.1.31, production mode Token Create Found user with identifier 'token-create-test@localhost.dev', user's UUID is ef73711d-30cc-4e6a-be32-b69389e5522b. ▶ Successfully created new token: secret-token:BmTOWN1qv6gaFagt320Ntq .