WP-API / OAuth1

OAuth server implementation for WP API
http://oauth1.wp-api.org/
334 stars 112 forks source link

Request for complete example of OAuth used together with WP-API and Client-JS ? #40

Open EugeneLiang opened 10 years ago

EugeneLiang commented 10 years ago

Hi there,

Firstly, great work on the API ! Very much appreciated!

This version of API allows me to work a lot faster, thank you very much.

I was checking around and noticed that there is a lack of examples on how to use OAuth1 together with WP-API and Client-JS ( https://github.com/WP-API/client-js ). The closest example I can find is https://github.com/WP-API/api-console but unfortunately, the issues were not solved there.

Since OAuth1 plays such an important part of the WP-API, is it possible to write up a tutorial on how to use OAuth1 together with WP-API and Client-JS so that we understand how to connect to WP-API securely ?

( it seems that many people are requesting for a tutorial like this. Please help! )

Thanks!

romuloctba commented 10 years ago

+1

2014-10-08 12:45 GMT-03:00 Eugene Liang notifications@github.com:

Hi there,

Firstly, great work on the API ! Very much appreciated!

This version of API allows me to work a lot faster, thank you very much.

I was checking around and noticed that there is a lack of examples on how to use OAuth1 together with WP-API and Client-JS ( https://github.com/WP-API/client-js ). The closest example I can find is https://github.com/WP-API/api-console but unfortunately, the issues were not solved there.

Since OAuth1 plays such an important part of the WP-API, is it possible to write up a tutorial on how to use OAuth1 together with WP-API and Client-JS so that we understand how to connect to WP-API securely ?

( it seems that many people are requesting for a tutorial like this. Please help! )

Thanks!

— Reply to this email directly or view it on GitHub https://github.com/WP-API/OAuth1/issues/40.

EugeneLiang commented 10 years ago

@romuloctba I was wondering if you know of any other places ( Google groups etc ) that might have solution for this problem ?

romuloctba commented 10 years ago

not YET, but i'm quite close of finishing my implementation using angularJS

edit: not a promess thou, that i'll be done this wk ... lol 2014-10-08 12:49 GMT-03:00 Eugene Liang notifications@github.com:

@romuloctba https://github.com/romuloctba I was wondering if you know of any other places ( Google groups etc ) that might have solution for this problem ?

— Reply to this email directly or view it on GitHub https://github.com/WP-API/OAuth1/issues/40#issuecomment-58379681.

romuloctba commented 10 years ago

Follow-up:

  1. Generate the sign using oauth.js
  2. send'em via http to /request
  3. fetch the oauth_token returned by the WPI-API OAUTH SERVER
  4. Direct the page to http://yourURL.com/oauth1/authorize?oauth_token=YourTokenHere
  5. It sends you to the 'authorize application' page, where you click authorize and recieve a 'verification token' I got this far now.

Next step is to authenticate (/access) and then i'll have the needed parameters to perform authenticated requests (like post creation and stufff)

I soon as i get this done and nicelly modular i'll send you guys the link

no so many oAuth 1 references online, are they? I mean, not without providers like fb or tt

2014-10-11 9:19 GMT-03:00 Rômulo Zoch romuloctba@gmail.com:

not YET, but i'm quite close of finishing my implementation using angularJS + oAuth.JS by netflix (apache license) + sha1.js. I was able to perform a signed request and ge the token, then proceed to the authorization step. Well, i guess i'll be done this weekend, and i'll let you guys know

2014-10-08 12:49 GMT-03:00 Eugene Liang notifications@github.com:

@romuloctba https://github.com/romuloctba I was wondering if you know of any other places ( Google groups etc ) that might have solution for this problem ?

— Reply to this email directly or view it on GitHub https://github.com/WP-API/OAuth1/issues/40#issuecomment-58379681.

EugeneLiang commented 10 years ago

Sounds workable.

And yes there is very limited references for oauth1.

I was wondering if WP-API will support oauth 2 in the near future...

kosso commented 10 years ago

After some poking around in my fork and fixing the get_consumer lookup by key, I managed to get a very simple (ugly and verbose) PHP test working.

It will grab a request token, create the link to the host server to click on and authorize, then return the user back to itself and finally obtain the access token and secret for that user of the consumer app. (The consumer app needs to be generated via WP-CLI.)

https://github.com/kosso/OAuth1/blob/master/php_test/wp_oauth_test_auth_flow.php

It uses itself as the callback url.

I don't have it reading the Authorization request headers yet.

EugeneLiang commented 10 years ago

alrighty cool! will give it a test ride!

zanematthew commented 9 years ago

+1

Documentation seems to be lacking for the basics of getting OAuth up and running.

romuloctba commented 9 years ago

oAuth is wat stops me from using wp-api all day long :P

2015-01-30 18:40 GMT-02:00 Zane Matthew notifications@github.com:

+1

Documentation seems to be lacking for the basics of getting OAuth up and running.

— Reply to this email directly or view it on GitHub https://github.com/WP-API/OAuth1/issues/40#issuecomment-72266775.

jtsternberg commented 9 years ago

Not JS, but this is a WordPress to WordPress helper library: https://github.com/WebDevStudios/WDS-WP-JSON-API-Connect