-
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
json_oauth1_signature_mismatch / OAuth signature does not match #200
Comments
Nevermind, I got it working! |
@brandonkramer |
I am also facing the same issue @brandonkramer please update with the solution. |
@brandonkramer are you there??? |
I am also facing the same issue ..please update with the solution. |
For some more info here: A Typically if you are sending "complex" data over the wire, like nested objects, arrays etc it's very possible your implementation of oauth is generating a different signature than the OAuth 1 plugin. It's unfortunately the case that the spec isn't super clear on how to generate signatures for arrays - but the point is your client-side signature generation MUST match the algorithm from the PHP side. See https://github.com/WP-API/OAuth1/blob/master/lib/class-wp-rest-oauth1.php#L629 for details (specifically https://github.com/WP-API/OAuth1/blob/master/lib/class-wp-rest-oauth1.php#L717 https://github.com/WP-API/OAuth1/blob/master/lib/class-wp-rest-oauth1.php#L730 https://github.com/WP-API/OAuth1/blob/master/lib/class-wp-rest-oauth1.php#L754). Yes, generating a signature is a pain! I've had to walk through the generation process several times when building out https://github.com/WP-API/wordpress-rest-api-oauth-1. Check https://github.com/WP-API/wordpress-rest-api-oauth-1/blob/master/src/index.js#L160 for some nasty hacks to get the This is a tricky thing to debug, the only "good" way I've done this is to add log statements in both the client side and PHP side and compare for each step, find where the difference appears in the signature generation and work out why that is. @rmccue might be able to chime in with why this is not specced well in the standard - however a good start might be to have some oauth library implementations that we know to be compatible and release some that don't exist. |
I selected x-www-form-urlencoded from Body section (for request) in Postman, and it worked for me |
I've authenticated with my WP API and successfully able to post a comment with Postman but posting a comment from my client gives me the following error "{code: "json_oauth1_signature_mismatch", message: "OAuth signature does not match",…}"
Can someone help me out? I've used "bettiolo/oauth-signature-js" as signature generator
The text was updated successfully, but these errors were encountered: