How can I solve a "JWT is not configured properly" issue?

Viewed 654

I try to connect my website with my WordPress API. Backend and frontend are both on localhost. Creating a user is working well but when I try to login, I get a

JWT is not configured properly

error.

This is the error I have using Insomnia:

{
    "success": false,
    "statusCode": 403,
    "code": "jwt_auth_no_auth_header",
    "message": "Authorization header not found.",
    "data": []
}

console-log jwt issue

I have added this line of code on the auth plugin :

            $auth = isset($allHeaders['AUTHORIZATION']) ?  $allHeaders['AUTHORIZATION'] : false;

I don't know where if the issue is on the back or front code. And added SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 on my .htaccess

1 Answers

Move the definition of JWT_AUTH_SECRET_KEY to the top of your wp-config.php file after the following:

(AUTH_KEY, SECURE_AUTH_KEY, ... NONCE_SALT)

The definition of JWT_AUTH_SECRET_KEY must be added before:

require_once(ABSPATH . 'wp-settings.php');

This should resolve the bad config error.

Related