-
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
Unable to get the key and secret #39
Comments
That is because you don't have the wp-cli plugin installed on your server 2014-10-01 21:17 GMT-03:00 crisanders notifications@github.com:
|
The only way to install it is with root access, right? There is no package to download and install it thru Wordpress, correct? |
You can upload the contents of this .rar in your wp-content/plugins then 2014-10-02 2:30 GMT-03:00 crisanders notifications@github.com:
|
oops, sorry.. you can download it here: http://rcdev.com.br/palestraexemplos/create-key.rar |
I'll give it a try. In the mean time, we installed wp-cli thru root but when we run the wp oauth1 add command, nothing is returned. Should I just try your script? |
Yeah just give it a try Nothing special... If you want it in english I can translate it for you, You could even generate the key and secret, and then deactivate and exclude 2014-10-02 10:01 GMT-03:00 crisanders notifications@github.com:
|
That worked! Thank you! Question: what is the callback URL format? Something like http://example.com/auth_token? |
I'm still a bit confused what the next steps are. Basically everything is activated now, but need to perform OAuth handshaking and signs the user into the server. Not sure what the GET request to the request token URL is. |
oauth.googlecode.com/svn/code/javascript/example/signature.html the request will use the above inputs except for token and token secret. 2014-10-02 19:06 GMT-03:00 crisanders notifications@github.com:
|
The iOS developer says that we would also need to construct a URL to login into the site for the first time. But not sure if it's something like http://username:password@example.com or http://username:password@example.com/wp-json/ Does that ring a bell?' Again, thank you for your help, this is great advice |
I'm not sure you'll need that. We are talking about oAUTH, where you |
What's the easiest way to test if Oauth works? |
I'm getting OAuth signature does not match |
So I've been playing around with this a lot. I used the code you posted in a different thread and it seems that the base url is fine and it outputs the expected signature. Of course, when I use that with the CURL command, the signature matches. Is there something else I can do to figure it out? What parameters go into the generation of the signature? Maybe that's the issue. |
Check if you are in the / or some folder. If in some folder, you'll need to Additionally, if you are triyng to oAuth authenticate using Postman, forget 2014-10-03 8:06 GMT-03:00 crisanders notifications@github.com:
|
I used different methods to authenticate, even a CURL command that works for Twitter And recently, this one http://sevengoslings.net/~fangel/oauth-explorer/ the blog is under public_html/ so not under a folder. It's basically public_html/ and then rest of the Wordpress folders and files. Should I still use that patch? |
I don't think you'll need to patch just put the vars you want to show with the error message in line 563 2014-10-03 9:12 GMT-03:00 crisanders notifications@github.com:
|
I did, and it shows the expected signature which is different and shows the right URL. OAuth signature does not match. Shoud be: lIyaKX0eL3BetfAPRmH0WN8SsI8= Would love to show you the result maybe in a private email. |
Is it possible that the key I generated with that little plugin you wrote are different than the keys generated by wp oauth1 add command? |
No, because it uses the own plugin function to work 2014-10-03 10:28 GMT-03:00 crisanders notifications@github.com:
|
That is it, just don't forget that you should make your POST to the url 2014-10-03 10:35 GMT-03:00 crisanders notifications@github.com:
|
Try putting this in 563 return new WP_Error( 'json_oauth1_signature_mismatch', __( 'OAuth signature 2014-10-03 10:44 GMT-03:00 crisanders notifications@github.com:
|
Ok, I did that. See output. The used key seems to be the secret not the key. OAuth signature does not match. Used: KEY RPPUVhPqJolNJD40XCCPTbgjBP5fdIPRZr50sMZ3Ej8LL0DX& base url to encode: GET&http%3A%2F%2Fwww.site.com%2Foauth1%2Frequest&oauth_callback%3Doob%26oauth_consumer_key%3DlZIaHHktlADv%26oauth_nonce%3DorT8x9%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1412344816%26oauth_token%3D%26oauth_version%3D1.0 and base_uri: http%3A%2F%2Fwww.site.com%2Foauth1%2Frequest |
take that oauth callback off and try again without it.... Also, be sure you the key is right, it is the encription key - the secret one, that is used 2014-10-03 11:02 GMT-03:00 crisanders notifications@github.com:
|
Someone also asked in a different topic: are you/your host company changing directory to the actual wordpress root folder? cd /var/www/wordpress or whatever before running the wp command? |
So I got to the point to access and using this call which I'm not sure if it's correct http://username:password@site.com/oauth1/authorize?oauth_token=ooz77Fe76MXWyUcOPdhfaqmG Missing OAuth parameter oauth_verifier |
This verifyer should be returned with your token in the request proccess 2014-10-04 6:01 GMT-03:00 crisanders notifications@github.com:
|
So where is the mistake? Do we even need that call with the username and password? Is there a call sample I can see? |
No you wont send your username to authenticate with oauth...
here is a good resource: https://developer.chrome.com/extensions/tut_oauth 2014-10-04 9:06 GMT-03:00 crisanders notifications@github.com:
|
So on Step 3, what would that call look like? We already got the token and secret. |
@romuloctba, any chance you can re-post the plugin .rar? The link you posted previously is offline atm. Thanks in advance, :Benjamin Barnett |
Here you go, pal... But i believe someone released a better plugin, I'm not https://gist.github.com/romuloctba/b973ff6bf87452e72f83 The .rar had this file inside a folder create-key/ and also a png located 2015-03-24 14:51 GMT-03:00 BenjaminBarnett notifications@github.com:
|
Thanks, dude, you're an absolute life-saver. I just could NOT get wp-cli.phar to build on my server, it was driving me NUTS. A thousand thanks. :Benjamin Barnett |
here i try so far i use romuloctba plugin to create key and secret (thanks romuloctba ) and then i add the patch on authorization_oauth1.php $home_url_path = parse_url(get_home_url (null,''), PHP_URL_PATH ); and then i use http://oauth.googlecode.com/svn/code/javascript/example/signature.html but the end still show signature not match, any idea why? |
I believe I got as far as you.. Will try again soon, since it was long ago... I guess we are supose to PR the way out of this |
@wesleyxiao hope you discovered something nice |
Hello, @romuloctba "oops, sorry.. you can download it here: http://rcdev.com.br/palestraexemplos/create-key.rar" Your link is broken ? Can i have a good one ? Cheers |
@LudovicFauchet if not yet too late https://gist.github.com/romuloctba/b973ff6bf87452e72f83 |
storing key/secret as a post meta... seriously |
@younes0 Thanks for your input, but this is not constructive. If you have thoughts on things we should do differently, please file an issue with constructive comments. |
@rmccue my apologizes, but there's a lot of odd habits in the wordpress developers community, including how handling data storage is made, in a way that makes difficult database versioning and querying. And I'm not even talking about the fact they ignore the PHP Community (Composer packages, PSR). Why would you store tokens in the post/post_meta table ? Currently it's difficult to manage tokens. |
@younes0 Consumers are stored as post data in the backend, so it's natural to store this data as post meta. While we could create a custom table, there's a couple of good reasons we don't:
A better way to think about the structure is to think of posts as objects, and post meta as a key-value store for those objects. This generic object storage just happens to be unfortunately named "posts". In your example with rate limiting, it's actually easier to achieve this with a key-value store, as you can simply add an extra property (post meta row) to the object. A custom table would require database migrations, along with the ability to reverse that migration (if you disable the plugin). This can also potentially lead to conflicts with multiple plugins that add columns, etc. The only real issue here is that we're using a custom meta value to store the key, which is our primary key for finding the object. This makes lookups potentially expensive. That said, there is an index on |
@rmccue Thanks for the explanations! I should play more with the Wordpress API and not hitting directly the database. |
Installed the WP API plugin and then the OAuth1 as well, but every time I go my dedicated server and try to run this
The text was updated successfully, but these errors were encountered: