-
Notifications
You must be signed in to change notification settings - Fork 112
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
OAuth signature does not match in some cases #34
Comments
I found an another difference between WP-API with ZF. It seems multi-dimensional array are not enough sorted in signature string.
https://github.com/zendframework/ZendOAuth/blob/c0eca2ca6e930a5464a6a76ac1eb293237304d2a/library/ZendOAuth/Signature/AbstractSignature.php#L153 |
I'm facing a very similar problem, and this is what I did to find the real reason (the base_uri): This returns me the signature does not match error with the baseURL so i can compare. And the plugin is triyng to generate the the $base_request_uri is set here: https://github.com/WP-API/OAuth1/blob/master/lib/class-wp-json-authentication-oauth1.php#L524 |
@romuloctba , base url issue is an another problem, and already pull-requested. See: #32 |
Oh, sorry, my bad, should've read better |
I had the same issue (ZF2 and filter[posts_per_page]). I "fixed" this by changing the following:
to
I also looked at what Google did:
Encoded as
So Google double-encodes just like ZF2 so I assume WP-API is incorrect. |
Signature checking duplicates the WP install folder when building the request URI. For example, if you have a WordPress running on "www.example.com/wp", the signature checker will use URLs like "www.example.com/wp/wp/...". This commit removes the WordPress base directory from the checked path. See !32, WP-API#34, WP-API#27
Parameters with special characters that needs encoding should be encoded twice: 1. Encode as they are part of a URL, so they must be encoded; 2. Encode to join as the base string for signature. See WP-API#34
This was fixed some time ago, in #154 |
Hi, I'm trying to retrieve posts with authentication required parameters. I'm using Zend_OAuth library, and already succeeded to get access token and get authentication required data. However, with some parameters, I got "OAuth signature does not match" error (code: json_oauth1_signature_mismatch). Here is my code. Very normal.
The problem is the
filter[posts_per_page]
key.In ZendFramework, encode each parameter key and values first, then build query string, finally urlencode it again.
https://github.com/zendframework/ZendOAuth/blob/c0eca2ca6e930a5464a6a76ac1eb293237304d2a/library/ZendOAuth/Signature/AbstractSignature.php#L115
In WP-API/OAuth1, each parameter key and values are not encoded.
OAuth1/lib/class-wp-json-authentication-oauth1.php
Line 597 in 7d14454
So, which way is correct? IMHO, ZF way.
3.4.1.3.2. Parameters Normalization http://tools.ietf.org/html/rfc5849#section-3.4.1.3.2
But unfortunately, I don't have any experience of other OAuth provider, so I'd like to hear others opinion.
Thanks!
The text was updated successfully, but these errors were encountered: