Closed Steverino541 closed 10 months ago
Please answer the following questions for yourself before submitting an issue.
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
After generating a JWT token I should be able to validate that token and also be able to create posts
I am able to generate a token but when I request the validation endpoint I get the following error:
{ "code": "jwt_auth_bad_config", "message": "JWT is not configured properly, please contact the admin", "data": { "status": 403 } }
And I cannot perform any creation or editing actions because I get the same message
Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template.
Please provide detailed steps for reproducing the issue.
Add the following to wp-config.php: //* Define JWT auth key / define( 'JWT_AUTH_SECRET_KEY', 'my_key' ); define('JWT_AUTH_CORS_ENABLE', true);
Run a postman request against http://localhost:3000/wp-json/jwt-auth/v1/token?username=myadminuser&password=mypass
Run a request against http://localhost:3000/wp-json/jwt-auth/v1/validate with the Bearer Token set to the token that was generated
Please include any relevant log snippets or files here.
I solved it with this answer https://stackoverflow.com/a/69300300, I had to move the JWT_AUTH_SECRET_KEY definition to above require_once ABSPATH . 'wp-settings.php'; and then it worked 🙂
Issue Name
Prerequisites
Please answer the following questions for yourself before submitting an issue.
Context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
Expected Behavior
After generating a JWT token I should be able to validate that token and also be able to create posts
Current Behavior
I am able to generate a token but when I request the validation endpoint I get the following error:
{ "code": "jwt_auth_bad_config", "message": "JWT is not configured properly, please contact the admin", "data": { "status": 403 } }
And I cannot perform any creation or editing actions because I get the same message
Failure Information (for bugs)
Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template.
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
Add the following to wp-config.php: //* Define JWT auth key / define( 'JWT_AUTH_SECRET_KEY', 'my_key' ); define('JWT_AUTH_CORS_ENABLE', true);
Run a postman request against http://localhost:3000/wp-json/jwt-auth/v1/token?username=myadminuser&password=mypass
Run a request against http://localhost:3000/wp-json/jwt-auth/v1/validate with the Bearer Token set to the token that was generated
Failure Logs
Please include any relevant log snippets or files here.