Skip to main content

New Plugin Release 4.3.1

· 4 min read
Nicu Micle
Creator of Simple JWT Login

The version 4.3.1 has been released today on WordPress.

This release adds more wp jwt commands and changes how Protect Endpoints handles the REST API index (/wp-json/).

Breaking change

Protect Endpoints no longer blocks the REST API index (/wp-json/) unless a rule targets it, also when the default action is Require a valid JWT. To keep it protected, add a rule for /wp-json/. See Breaking changes.

New Features​

New WP-CLI commands​

  • wp jwt webhook add|remove|enable|disable - manage webhooks. See wp jwt webhook.
  • wp jwt api-key get|update|delete - update keeps the options you don't pass, and --expires-at=never removes the expiration. See wp jwt api-key.
  • wp jwt rule list|add|remove - manage JWT Rules. Keys are never listed, and a random key is generated when none is given. See wp jwt rule.
  • wp jwt integration list|enable|disable - turn OAuth providers and 3rd-party integrations on or off. See wp jwt integration.
  • wp jwt refresh-token list <user> - list a user's active refresh tokens, without their values. See wp jwt refresh-token.
  • wp jwt key status - show the algorithm, the key source and the old keys kept by key rotate. The keys themselves are never printed. See wp jwt key.
  • wp jwt config reset <section>...|--all - reset settings to their defaults. Secrets are kept unless you pass --include-secrets. See wp jwt config reset.
  • wp jwt log list --all - list every matching entry, for example --all --format=csv to export the log. See wp jwt log.

wp jwt call​

wp jwt call <method> <route> --as=<user> calls a REST endpoint over HTTP with a new 5-minute JWT for the user. No refresh token is stored. Use it to check protected endpoints, CORS and JWT Rules the same way a real client sees them. See wp jwt call.

wp jwt call GET /wp/v2/users/me --as=admin

Tab completion​

wp jwt completion prints a completion script for the wp jwt commands and options. WP-CLI's own completion doesn't know about plugin commands. See Tab completion.

wp jwt completion >> ~/.bashrc
wp jwt completion --shell=zsh >> ~/.zshrc

Breaking changes​

Protect Endpoints no longer blocks the REST API index (/wp-json/, the discovery endpoint) unless a rule targets it. This applies also when the Default Action is Require a valid JWT (#105).

To keep the index protected, add an endpoint rule for /wp-json/. It matches the index only, never the other routes. See Protect Endpoints.

Bug Fixes​

  • wp jwt key rotate and wp jwt setup: a JWT issued in the same second as the rotation was rejected right away instead of being kept until it expires. The rotation now waits for the next second (at most one second).
  • wp jwt validate now reports an expired token signed with a rotated or changed key as expired, instead of only "Signature verification failed". The token is still reported as not valid (exit code 1).
  • Webhooks with a JSON body (the default payload or a JSON payload template) are now sent with Content-Type: application/json instead of application/x-www-form-urlencoded. A Content-Type header set on the webhook is still used as is. See Webhooks.

If you encounter any issues after updating, please open an issue on GitHub.