New Plugin Release 4.3.0
The version 4.3.0 has been released today on WordPress.
The WP-CLI commands are now part of the plugin, and every new JWT gets a unique jti claim. If the separate Simple-JWT-Login CLI plugin is installed, deactivate and delete it after updating.
New Features
WP-CLI commands built into the plugin
The wp jwt commands now ship with the plugin. You can turn them on or off in General > CLI, and they are on by default. See the WP-CLI documentation.
- Commands that were in the separate CLI plugin:
wp jwt login,decode,validate,revoke, andwp jwt config get|set|list|export|import wp jwt config setandwp jwt config importnow run the same validation as saving the settings in wp-admin. Use--forceto skip it.- While the separate Simple-JWT-Login CLI plugin is active, the built-in commands stay disabled, the setting defaults to off, and the CLI card shows a warning. Deactivate and delete that plugin to use the built-in commands. See Enable or disable the commands.
New commands:
wp jwt setup- set up the plugin from the command linewp jwt generate- issue a JWT for a user without their passwordwp jwt refresh- exchange a refresh token for a new JWTwp jwt revoke-all- revoke every JWT and refresh token of a user, whether or not "Revoke tokens on password change" is onwp jwt key generate|rotate---algorithm=randompicks a random algorithm and generates a matching keywp jwt api-key create|list|revokeandwp jwt auth-code list|add|removewp jwt doctor,security-report, andexplain-errorwp jwt log list|analyze,wp jwt webhook list|test|logs, andwp jwt cleanup
List commands support --format=table|csv|json|yaml|count and --fields.
Other changes to the CLI:
wp jwt loginno longer needs--passwordon the command line. It prompts for the password (hidden input) or reads it from STDIN.wp jwt validateexits with code1when the token isn't valid, so you can use it in scripts and CI.
Key rotation without breaking issued tokens
wp jwt key rotate keeps the old key in a JWT Rule that matches tokens issued before the rotation, so those tokens stay valid until they expire. The daily cleanup removes the rule after that. Use --immediate when the old key has leaked and every token signed with it must stop working at once. wp jwt setup uses the same mechanism when it replaces a key. See wp jwt key.
To support this, JWT Rules have a new less than operator for whole-number claims such as iat.
New jti claim
Authentication > JWT payload has a new jti claim: a unique, random ID added to every issued JWT. Before 4.3.0, two tokens issued for the same user in the same second were identical, so revoking one also revoked the other. With jti, every token is different.
jtiis enabled by default, including on existing sites. The settings migration (settings schema version 3) adds it to the saved payload list.jtiis a reserved payload key and can't be set through custom claims or thepayloadrequest parameter.- The admin page and the security report show a warning when
jtiis turned off.
See JWT Payload Configuration.
Audit log events for WP-CLI
Two new audit log events, cli.command.success and cli.command.failed, record the WP-CLI commands that change something. A command that turns off the audit log is still recorded. See WP-CLI events.
Bug Fixes
- Fix a database error on
/revoked-tokens,/api-keys, and the audit and webhook logs when apagefar past the last one is requested: the SQL offset overflowed into a negative number. Such pages now return an empty list. - Fix a
500error on/users,/user/reset_password,/auth/refresh, and/oauth/tokenwhen a parameter is sent as an array or an object. These requests now get the usual validation error. - Fix a PHP fatal error when a webhook with the
GETmethod was called.GETwebhooks now send the event fields as query parameters and don't use the payload template. See Webhooks. - Saving the settings now rejects an unsupported JWT algorithm (settings error code
2010) instead of storing it and then failing on every token.
API Reference
- The
idin the decoded JWT payload returned by/auth/validateis now documented as a numeric string, which is how the endpoint returns it - A Schemathesis check (
composer run test-openapi, also run in CI) now verifies that the live REST responses match the OpenAPI spec
If you encounter any issues after updating, please open an issue on GitHub.
