Skip to main content
WP-CLI Add-on

JWT auth at your
fingertips

Generate tokens, validate JWTs, revoke sessions, and manage every plugin setting directly from your terminal — no WordPress admin UI required.

bash
# Authenticate a user and get a JWT
$ wp jwt login --username=admin --password=secret
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZXhwIjoxOTk5OTk5fQ.sig
$ 
# Validate the token
$ wp jwt validate "$TOKEN" --format=json
{"valid":true,"message":"Token is valid."}
$ 
# Migrate config to production
$ wp jwt config export --file=jwt-config.json
$ wp jwt config import jwt-config.json --yes --url=https://prod.example.com
Success: Configuration imported.
Works anywhere WP-CLI runs
8 commands, everything covered
Requires Simple JWT Login plugin
Free & open source

Every command you need

From token generation to full config management — the CLI covers the complete JWT lifecycle.

Authenticate & get a token

Authenticate any WordPress user by username, email, or a combined login flag and receive a signed JWT immediately. Pipe it directly into curl, store it in a variable, or forward it to other tools.

Full docs →
bash
# Authenticate by username
$ wp jwt login --username=admin --password=secret
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
$ 
# JSON output — parse with jq
$ wp jwt login --username=admin --password=secret --format=json
{"jwt":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."}
$ 
# Capture and use immediately with curl
$ TOKEN=$(wp jwt login --username=admin --password=secret)
$ curl -H "Authorization: Bearer $TOKEN" https://example.com/wp-json/wp/v2/posts

Built for real workflows

The CLI is designed for the scenarios where speed and scriptability matter most.

CI / CD pipelines

Generate a short-lived JWT inside your pipeline to seed test data, run authenticated smoke tests, or hit protected API endpoints — no browser, no cookies.

TOKEN=$(wp jwt login --username=admin --password="$WP_ADMIN_PASSWORD")
curl -s -X POST https://my-site.com/wp-json/wp/v2/posts \
  -H "Authorization: Bearer $TOKEN" \
  -d '{"title":"Smoke test post","status":"publish"}'

Staging → production migrations

Export the full plugin config from staging with one command, preview the diff on production in dry-run mode, then apply — fully non-interactive.

# Export from staging
wp jwt config export --file=jwt-staging.json

# Preview changes (dry-run)
wp jwt config import jwt-staging.json --dry-run --url=https://example.com

# Apply without prompts
wp jwt config import jwt-staging.json --yes --url=https://example.com

Automated health checks

Add a cron job or monitoring script that logs in, validates the token, and alerts your team when JWT authentication breaks.

TOKEN=$(wp jwt login --username=healthcheck --password="$HC_PASSWORD")
STATUS=$(wp jwt validate "$TOKEN" --format=json | jq -r '.valid')
[ "$STATUS" = "true" ] && echo "JWT OK" || { echo "JWT FAILED"; exit 1; }

Get started in 60 seconds

Requirements

  • WordPress4.4+
  • PHP5.5+
  • Simple JWT Loginactive
  • WP-CLIany recent stable
1
Install from WordPress.org

Go to Plugins → Add New, search for Simple JWT Login CLI, and click Install Now.

2
Activate the plugin

The add-on registers its commands automatically once activated. Simple JWT Login must be active on the same site.

3
Verify the commands
bash
$ wp jwt --help
usage: wp jwt <command> [<args>]

Complete command reference

All 8 commands at a glance.

wp jwt loginAuthenticate a user and return a JWT token
wp jwt decodeDecode a JWT payload (signature not verified)
wp jwt validateVerify signature and expiry of a token
wp jwt revokePermanently revoke a token
wp jwt config getRead a single plugin setting
wp jwt config setUpdate a plugin setting
wp jwt config listList all settings as key/value pairs
wp jwt config exportExport full config as JSON to stdout or file
wp jwt config importImport config from a JSON file

Ready to automate your JWT workflow?

Install the add-on in minutes and bring the full power of Simple JWT Login to your terminal.