Rest API authentication with Headless WordPress
WordPress provides built-in support for authenticating the incoming request to its restful API, which is handy.
Application Password
- generate set an application password
- use it for authentication
http://localhost:8888/wp-json/wp/v2/posts/1
using Basic Authentication
- Username: YOUR_LOGIN_USERNAME
- Password: APPLICATION_PASSWORD
On Local Development
reference
define WP_ENVIRONMENT_TYPE to enable Application Password in a local environment without HTTPS
define( 'WP_ENVIRONMENT_TYPE', 'local' );