-
Notifications
You must be signed in to change notification settings - Fork 96
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
OpenSSL error in WP_Auth0_Api_Client_Credentials::call #631
Comments
I do not understand, why the API token is decoded at all. I only need the token, but not the decoded version, as obvious in line 86-87 of
|
@coperator - That decoding is also validating the access token we get back for the Management API. So, while we don't use any of the data in there, we're checking to make sure it's valid. You mentioned the "JsonWebToken Signature Algorithm" for the Application in Auth0 but this is for the Management API so that setting is APIs > Auth0 Management API > Signing Algorithm (should be RS256 and not able to be changed). I just tested locally and everything works if the JWT algorithm is set to RS256. It looks like the problem, though, is when the algorithm is set to HS256. The access token for the Management API is always RS256 but the secret used to decode it comes from the application setting, which is not correct (bug in the plugin). Easiest way to get around this before a fix is applied is to switch your Applications JWT algo to RS256 in Auth0 and in the plugin (that's the recommended setting). Otherwise, if you need to keep it HS256, the code change below needs to happen on this line:
As an aside ... I think this is over-stepping a bit on the part of the plugin and will be addressed in the next version. We're changing a number of things about how that token is generated, stored, and used to cut down on the number of API calls we're making and follow more closely the OAuth standards around access tokens. Apologies for the trouble here and thank you for the clear and detailed report! |
@joshcanhelp Thank you for your prompt reaction and explanation! However, as mentioned above, in my mindset applications should not care about decoding access tokens. |
Yes, this is guidance we typically give. In this case, the intent was a slightly better experience but I came up with a better way to do that in #632. Thanks again for the report here! |
Description
The error happens, if a user tries to change his password.
Since there is no valid api_token, Wordpress calls
WP_Auth0_Api_Client_Credentials::call()
.The JWT::decode() fails to verify the signature:
The DomainException is thrown:
and written to the Auth0 Log.
The line 80 in
php-jwt/JWT.php
:seems to result in a broken
$sig
.I checked the token returned from the Auth0 Management API with https://jwt.io/ and the signature is verified successfully.
What could be the problem?
Environment
Please provide the following:
The Client Secret is not base64 encoded.
The JsonWebToken Signature Algorithm of the client is set to HS256 in the Auth0 management console and also in the Wordpress Auth0 settings.
The text was updated successfully, but these errors were encountered: