You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After 2 days of checking I've found the problem, in short, version 0.4.x (0.4.2 for sure) added extra sanitize_text_field() in get_authorization_header() method of WP_REST_OAuth1 class (wp-content\plugins\rest-api-oauth1\lib\class-wp-rest-oauth1.php line 87) - version 0.3.0 didn't had it and it worked. This extra sanitization causes removal of padding equal sign (=) from oauth_signature string (base64 encoded) in auth header and this causes signature mismatch here (line 742):
if ( ! hash_equals( $signature, $consumer_signature ) )
at this point with extra sanitization vars look like:
without extra sanitization, changing line 87 mentioned above from return sanitize_text_field( wp_unslash( $_SERVER['HTTP_AUTHORIZATION'] ) ); to return wp_unslash( $_SERVER['HTTP_AUTHORIZATION'] );
After 2 days of checking I've found the problem, in short, version 0.4.x (0.4.2 for sure) added extra
sanitize_text_field()
inget_authorization_header()
method ofWP_REST_OAuth1
class (wp-content\plugins\rest-api-oauth1\lib\class-wp-rest-oauth1.php line 87) - version 0.3.0 didn't had it and it worked. This extra sanitization causes removal of padding equal sign (=) from oauth_signature string (base64 encoded) in auth header and this causes signature mismatch here (line 742):if ( ! hash_equals( $signature, $consumer_signature ) )
at this point with extra sanitization vars look like:
$signature = "2jnndRHY0XmcoLAKQ57BTk3hFuY="
$consumer_signature = "UxNEGv4G7XLC8deayKGWTdUmt0"
without extra sanitization, changing line 87 mentioned above from
return sanitize_text_field( wp_unslash( $_SERVER['HTTP_AUTHORIZATION'] ) );
toreturn wp_unslash( $_SERVER['HTTP_AUTHORIZATION'] );
they are:
$signature = "eo/0c0cV8mGq3srFuKowKTtuVBg="
$consumer_signature = "eo/0c0cV8mGq3srFuKowKTtuVBg="
and everything works fine.
The text was updated successfully, but these errors were encountered: