WP rest api jwt auth WP rest api jwt auth wordpress wordpress

WP rest api jwt auth


It looks like you did not include Authorization headers in your request. You need to add 'Authorization': 'Bearer PLACE_TOKEN_HERE' in your request headers.

As a sample:

var req = {    method: 'POST',    url: window.location.href + 'wp-json/wp/v2/posts',    headers: {      'Authorization': 'Bearer ' + TOKEN_GOES_HERE    }    data: DATA TO PASS GOES HERE}$http(req);


If the answer provided by Leo Gono and Tunaki still doesn't solve your problem, make sure you've added the following code to your .htaccess if you're using Apache:

RewriteEngine onRewriteCond %{HTTP:Authorization} ^(.*)RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]

Make sure to put those lines before the last line with an "[L]" in your .htaccess or else it won't get processed.

It's possible that the Authorisation header gets discarded by server of framework settings. (I've had to change the htaccess for Laravel)


I bumped into similar problems while setting up the same plugin so I created a video detailing the process I followed to quickly launch a test environment, install the plugin, perform the necessary setup for the plugin to work and then validate its functionality.

Here it is: https://youtu.be/Mp7T7x1oxDk