I have tried every which way to authenticate a post request.
WP User Plugin - As per the docs, I've logged in at
wp-json/wpuser/v1/user/login
and received my token. I've passed that token as a header called "Authorization" (also tried "authorization") with my POST request towp-json/wp/v2/job-listings/
I get401: rest_cannot_create
. I also tried this withauthorization
as a parameter, as well ash:authorization
, and with an uppercase "A" as well.JSON API Plugin - Generate nonce with
get_nonce/?controller=auth&method=generate_auth_cookie
, generate a cookie withauth/generate_auth_cookie
using the nonce and credentials, tried to POST with, alternatively, the cookie and the nonce as the value of anX-WP-Nonce
header. Both return403: rest_cookie_invalid_nonce
Tried adding
RewriteCond %{HTTP:Authorization} ^(.*) RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
to my.htacces
file and tried the above.
I don't want to use the Basic Auth plugin because of its security issues (and believe me, I've tried it in the past to no avail).
Please, whatever you do, do not simply link to me to the WP REST API handbook. I have read it and I can't figure out where to get the nonce from, so I'd welcome an actual explanation on that but please don't just link me to that page.
I'm happy to add some server code if necessary, but these plugins imply that I shouldn't have to.
Please help. Thank you.