Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

403 bad config error #298

Open
Imdamandude94 opened this issue Feb 15, 2024 · 2 comments
Open

403 bad config error #298

Imdamandude94 opened this issue Feb 15, 2024 · 2 comments

Comments

@Imdamandude94
Copy link

Issue Name

Prerequisites

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

  • [y ] I am running the latest plugin version
  • [ y] I am running the latest WordPress version
  • [ y] I know what PHP version I'm using
  • [y ] I checked the documentation and found no answer
  • [ y] I checked to make sure that this issue has not already been filed

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

  • WordPress version - 6.4.3
  • PHP Version - 8.1.27 (Supports 64bit values)
  • Plugin A name and version - jwt-authentication-for-wp-rest-api/

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
}
}

@MarleVVLL
Copy link

I am experiencing the same issue. I hope a response is forthcoming.

@MarleVVLL
Copy link

Fixed the issue.

You must define your secret key above this PHP line:

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants