WP Rest API with JWT Authentication

Question

I am working on a headless CMS with a React front-end / WordPress backend at the moment. The wordpress site is hosted at the main domain(example.com) and the react site is hosted at a subdomain(demo.example.com). I am trying to authenticate to the REST API with a JWT token (generated via JWT Authentication for WP REST API plugin) and have run into a few issues. Prior to adding this bit of code to my htaccess, I was able to generate a JWT token but have received a 403 for all requests trying to validate with that token:

RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

Now that this code is in place, when trying to get a token from example.com/wp-json/jwt-auth/token I receive a 403 & no token. Has anyone run into this before?

0
, TomBuilds 4 years 2020-03-29T20:52:54-05:00 0 Answers 102 views 0

Leave an answer

Browse
Browse