Michael2210441
Posts: 0
Joined: Sat Jan 04, 2014 5:42 pm

How to connect to WP4.4 REST API with Authorization?

Hey Andrew,

Thanks for all this and I definitely look forward to seeing your sample app if you get it going. I am gearing up for another attack at this since I haven't had any luck finding anyone to hire.

I think there's a premium Oauth plugin for WP emerging that might provide what Oauth.io does. I think I'm starting to get enough of a picture to get farther adapting the documentation to make it work. The challenge is blocking out the time to have the bandwidth. :)

I'll do the same and share my results if I get anywhere. THanks!

Andrew Peacock
Posts: 0
Joined: Thu Jan 09, 2014 10:03 pm

How to connect to WP4.4 REST API with Authorization?

Hi Michael,
Quick question - are you authenticating on the mobile, against users that are already set up on WP? Or are you allowing to enter their social details on the mobile, and the infrastructure (app, WP, Auth0, appery, etc, etc) will register them if that social profile is new, or log them in if it is already set up in WP?

Andy

Michael2210441
Posts: 0
Joined: Sat Jan 04, 2014 5:42 pm

How to connect to WP4.4 REST API with Authorization?

If I understand the WP side of it right, it's against one existing account created for the app. The demo app I'm working on I just want to use the WP database via REST.

Andrew Peacock
Posts: 0
Joined: Thu Jan 09, 2014 10:03 pm

How to connect to WP4.4 REST API with Authorization?

Hi Michael, have you looked at this:

http://wp-api.org/guides/authenticati...

Is that the REST API you're using?

I've had some progress with auth0.com: I've got it working in a simple localhost development on my PC, using their sample project. This means the code and configuration are good. I'll see if I can tweak that to work in the web-based tester for Appery, then in the full compiled app.

Andy

Michael2210441
Posts: 0
Joined: Sat Jan 04, 2014 5:42 pm

How to connect to WP4.4 REST API with Authorization?

Hey Andy,

Yes, that's the plugin documentation. I am specifically sticking to the constraint of using the "official" REST and Oauth plugin combo since they will eventually be merged into the WP core.

I get as far as running the command line to create the consumer and the command is not recognized and my understanding gets real fuzzy for alternatives... but working on that!

Michael2210441
Posts: 0
Joined: Sat Jan 04, 2014 5:42 pm

How to connect to WP4.4 REST API with Authorization?

Had a quiet day and made some progress...

In spite of the misleading documentation, just installing the two WP plugins as you would any other plugin and activating is step one.

Then there's a new and barely mentioned admin interface under Users.

The only required piece of information in the admin interface is the apps callback url and it must match info passed in headers.

I think the best way to configure the callback url is the only missing piece for me to be able to actually get results returned.

Michael2210441
Posts: 0
Joined: Sat Jan 04, 2014 5:42 pm

How to connect to WP4.4 REST API with Authorization?

OK, sat down yesterday and finally made good progress and actually got this working. In the end, my bigger hangup was on the WP side, than on Appery. Most of the documentation is out of date because of changes to the WP plugins involved. Here's a rough outline of what I did in pure pseudobabble.

ul
liInstall both the WP-API and WP-Oauth plugins. These are the official WP plugins and will soon be integrated into the core of Wordpress./li
liOnce activated, go to Users Applications in the WP backend./li
liCreate a new consumer here by completing the details requested and this step will generate the client_key and client_secret you will need when connecting./li
liWP only needs the key, secret and callback url when sending a request. In Appery I created a new REST Settings service page to hold these three settings, but eventually I will move these settings to a database for better security./li
liFor new services I create, I can just include this settings page to access the saved properties./li
/ul

Andrew Peacock
Posts: 0
Joined: Thu Jan 09, 2014 10:03 pm

How to connect to WP4.4 REST API with Authorization?

Glad you got it working Michael.
Andy

Return to “Issues”