Connecting an app, a headless front end or an automation tool to WordPress means picking an authentication method for the REST API. The two you will see most often are Application Passwords, built into WordPress since 5.6, and JWT (JSON Web Tokens), added with a plugin. They solve different problems. This guide compares Application Passwords vs JWT side by side, with a simple rule for choosing, and the security habits that matter with either one.
The short answer
- Server-to-server integration (Zapier-style automations, a publishing tool, a script on your own server): use Application Passwords. No plugin, revocable one by one, and WordPress records when each was last used.
- Users logging in to a separate front end or mobile app: use JWT, or another token method, so users exchange their login for a short-lived token instead of storing a long-lived password.
- JavaScript running inside your own WordPress site: use neither. The normal login cookie plus a REST nonce is the built-in method for that.
How Application Passwords work
A user (or an app, through the built-in authorisation screen) creates a named 24-character password from their profile. The app sends the username and that password in an HTTP Basic Auth header with every request:
curl -u "editor-bot:abcd EFGH 1234 ijkl MNOP 5678" https://example.com/wp-json/wp/v2/posts
- Built into core, works with the REST API and XML-RPC.
- Only available over HTTPS (or on a site whose environment type is
local). - Stored as a one-way hash (BLAKE2b since WordPress 6.8). Shown once, never again.
- Each one shows created, last used and last IP, and can be revoked on its own.
- No expiry. A password works until it is revoked.
- Cannot log in to wp-admin, but has the user’s full permissions through the API.
How JWT works in WordPress
WordPress has no JWT support in core. The most used plugin is JWT Authentication for WP REST API (by Tmeister, about 60,000 active installs, version 1.5.0). The flow:
- You add a secret key to wp-config.php:
define('JWT_AUTH_SECRET_KEY', 'long-random-string'); - On Apache you may need an .htaccess rule so the
Authorizationheader reaches PHP. - The app POSTs the user’s normal username and password to
/wp-json/jwt-auth/v1/tokenand gets back a signed token. - Later requests send
Authorization: Bearerplus the token. WordPress checks the signature and expiry, with no password involved.
In the free plugin, tokens expire 7 days after they are issued by default (changeable with the jwt_auth_expire filter). There is no way to revoke one token early: you can only change the secret key, which logs out every token at once. Token refresh and revocation endpoints are part of the paid Pro version.
Application Passwords vs JWT at a glance
| Application Passwords | JWT (plugin) | |
|---|---|---|
| Needs a plugin | No, core since 5.6 | Yes |
| What the app stores | A long-lived password | A token that expires |
| Expiry | None, until revoked | 7 days by default (free plugin) |
| Revoke one credential | Yes, per password | Not in the free plugin |
| Usage tracking | Last used date and IP | None built in |
| Setup | Create in the user profile | Secret key, maybe server config |
| Best for | Server-to-server integrations | User logins in apps and headless front ends |
| Main risk | Forgotten passwords with admin rights | Leaked secret key; tokens valid until expiry |
When Application Passwords are the better choice
For a machine talking to WordPress, Application Passwords are simpler and easier to audit. You give each integration its own named password, ideally on its own low-privilege user, and you can see whether it is still in use. When you stop using a tool, you revoke its password and nothing else changes. Our step-by-step guide shows how to audit WordPress Application Passwords and turn them off if you do not need them.
Never put an Application Password in browser JavaScript or a public mobile app bundle. Anyone can read it there.
When JWT is the better choice
When real people log in through something other than wp-admin, such as a React or Next.js front end or a mobile app, JWT fits better. Users type their normal password once, the app keeps only a token, and the token expires on its own. Keep expiry short for sensitive sites, store tokens securely (not in localStorage if you can avoid it) and keep the secret key out of version control.
Security habits for either method
- HTTPS only. Both methods send credentials in headers that must never travel unencrypted.
- Least privilege. Integrations get the lowest role that works, never an administrator by default.
- Rate limits and lockouts on the API. Bots guess passwords against XML-RPC and the REST API too. The 007AJ Security Scanner & Firewall Suite (disclosure: our product) locks out IP addresses after failed logins on the login form, XML-RPC and Application Passwords, and rate-limits REST requests.
- Turn off what you do not use. No integrations? Disable Application Passwords and XML-RPC.
- Review regularly. Revoke unused Application Passwords and rotate the JWT secret if you suspect a leak.
Protecting the human logins as well? Compare the best WordPress login security plugins for 2026.
Frequently asked questions
Is JWT more secure than Application Passwords?
Not automatically. JWT tokens expire, which limits damage if one leaks, but the free plugin cannot revoke a single token. Application Passwords never expire but can be revoked one by one and show when they were last used. The right choice depends on who is logging in.
Do I need a plugin for Application Passwords?
No. They have been part of WordPress core since version 5.6. The site must use HTTPS, unless its environment type is set to local.
Can I use Application Passwords in a headless front end?
Only on the server side. Never ship an Application Password in browser JavaScript or a mobile app, because anyone could read it. For user logins in a front end, use JWT or another token method.
How long does a WordPress JWT token last?
With the JWT Authentication for WP REST API plugin, 7 days by default. Developers can change it with the jwt_auth_expire filter.
Which method does WordPress use for its own JavaScript?
Cookie authentication with a REST nonce. Scripts running inside wp-admin or your own theme use the logged-in user’s cookie and send the nonce in the X-WP-Nonce header.
More free tools: see all our free WordPress plugins or browse the 007AJ shop.
