Closed LadisWasharum closed 1 year ago
I solved this issue. The plugin works, RS256 is just not documented and required running around in circles for a bit.
The documentation says to add the following to wp-config:
define('JWT_AUTH_SECRET_KEY', 'your-top-secret-key');
and it says you can use a key string from
The issue is that RS256 requires an RSA key, which you can generate from here and paste as is: https://travistidwell.com/jsencrypt/demo/
For those of you who are using firebase for authentication with this plugin, you will need to make sure to download the private key generated for firebase, open up the file, and copy everything within the private_key. Another important note, you will need to replace the single quotation marks
'your-top-secret-key'
with double quotation marks
"your-top-secret-key"
So the final should look like this:
define('JWT_AUTH_SECRET_KEY', "-----BEGIN PRIVATE KEY-----\nyour-top-secret-key\n-----END PRIVATE KEY-----\n");
Issue Description:
I'm experiencing problems while trying to implement the 'RS256' algorithm with the jwt_authalgorithm filter for JWT. When the filter is applied, I encounter HTTP 500 error and the token response is broken. When the RS256 filter is not applied, and my other filters for JWT are enabled (see bottom of post)_, the token generates with the required data, just not using RS256.
Here is the filter I am using that is causing the issue (other filters I am using with no issues at bottom):
Environment:
Steps to Reproduce:
Expected Behavior:
I expected the plugin to use the 'RS256' algorithm for JWT without any issues.
Actual Behavior:
Applying the jwt_authalgorithm filter results in HTTP 500 error for API response in postman when generating a token (token generates fine without 'RS256' filter enabled)_.
Error Logs:
Error log when RS256 enabled and token is called via Postman (token response is not successful):
Error log when RS256 is not enabled and token is called via Postman (token response is successful):
.htaccess File:
Additional Information:
I am using the current filters without issues to meet the requirements of firebase:
Any guidance on how to resolve these issues and implement 'RS256' with your plugin would be greatly appreciated. Thanks in advance!