Tmeister / wp-api-jwt-auth

A simple plugin to add JSON Web Token (JWT) Authentication to WP REST API
GNU General Public License v2.0
546 stars 160 forks source link

403 bad config error #298

Open Imdamandude94 opened 5 months ago

Imdamandude94 commented 5 months ago

Issue Name

Prerequisites

Please answer the following questions for yourself before submitting an issue.

Context

I have setup my .htaccess and wp-config as instructed in the documentation but when i run my POST https://hummrah.com/wp-json/jwt-auth/v1/token, i get the error "JWT is not configured properly, please contact the admin". This is my .htaccess:

RewriteEngine On RewriteRule ^(.*)$ - [E=HTTP_AUTHORIZATION:%1] RewriteEngine on RewriteCond %{HTTP:Authorization} ^(.*) RewriteBase /~hummrahc/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /~hummrahc/index.php [L]

SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

Expected Behavior

Token received and a 200 status

Current Behavior

Bad config error

Please provide detailed steps for reproducing the issue.

  1. Step 1 - Update my .htaccess to include: RewriteEngine on RewriteCond %{HTTP:Authorization} ^(.) RewriteRule ^(.) - [E=HTTP_AUTHORIZATION:%1] and SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
  2. Step 2 - Update my wp-config to include: define('JWT_AUTH_SECRET_KEY', 'your-top-secret-key'); and define('JWT_AUTH_CORS_ENABLE', true);
  3. Step 3 - I run https://hummrah.com/wp-json/jwt-auth/v1/token on Postman

Failure Logs

{ "code": "jwt_auth_bad_config", "message": "JWT is not configured properly, please contact the admin", "data": { "status": 403 } }