-
Notifications
You must be signed in to change notification settings - Fork 35
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
How to use it... #2
Comments
Hi Matthew, first thanks for this nice add-on. I'll try to explain, how i accomplished it: first i have copied the auth.php into json-api/controllers to simplify things a bit. next i have copied the get_nonce() from the core controller into auth.php, so i can simply deactivate all functions except those who i need. then i've setup a simple page (html+js) from where i try to access the json-api via ajax calls. Structure.init('App');
|
Now you have a cookie to authenticate. But beware that you'll need more nonces if you're trying to call other controllers than i did in the example. |
Argh! Still not enough information to use this!!! I can get your code above, to work, with some fixes, but I cannot get any kind of authentication to work when submitting a comment or post!!! How do you make the JSON API use the cookie?!?!? |
I'll see if I can get an example controller for posting using the Auth controller up this week. That will help I think. |
Thank you! I was about to try to modify the code to add username/password.... On Oct 23, 2012, at 4:37 PM, Matthew Berg [email protected] wrote:
...David I. Gross... Web site: http://www.davidgrossphoto.com/ CONFIDENTIALITY NOTE: |
Hi Matt, Just wondering if you still intending creating a sample? I'm creating some custom controllers which will send user specific data, and had intended using your get_currentuserinfo as the basis for my own controller, but would be good to see another example 'from the source'. Thanks, |
Yes I should be able to add that today. Sorry about that. |
Thank you! On Nov 5, 2012, at 5:54 AM, Matthew Berg [email protected] wrote:
...David I. Gross... Web site: http://www.davidgrossphoto.com/ CONFIDENTIALITY NOTE: |
OK Check out the latest posts.php file. I updated the original posts.php that comes with the JSON API to use the authentication check from the Auth controller. |
I hope I've done this correctly! I branched wp-json-api, and added my changes. Now, all actions require authorization. Please, let me know if I've done the github part right! Here's the branch: https://github.com/mimetic/wp-json-api-auth ...David I. Gross... Web site: http://www.davidgrossphoto.com/ CONFIDENTIALITY NOTE: |
Hey I am working with backbone.js and Looks like there are 3 cookies that need hash to be set properly. Where do you get hash to generate name of the cookie? |
The cookie is generated by the Wordpress function "wp_generate_auth_cookie". Make sure to set the type to 'logged_in'. |
I have tried for about two days to get this to work. I am not to sure its the code, How I am trying to use this 1> Ajax call to get Nonce $.ajax({
2> Ajax call to generate_auth_cookie with nonce to get cookie $.ajax({
3> Ajax call to generate_auth_cookie with nonce to get cookie $.ajax({ I have wrapped each in a separate function and called each in sequence. Once I got the nonce value but thats it I have a plugin in my site to allow cross domain calls. Any help is appreciated |
after posting the above code, I ended up getting it working. One of the functions was named do() , a reserved word. added some return false; and it worked. Here are the 3 functions that now all work for me function dop(){
then for calling them I attach an event handler to the login button and put it inside a document.ready $("#btnLogin").on("click", function(){ Thanks for making the integration between XCode/PhoneGap & wordpress easier. The authentication was the biggest hurdle for me. |
Hi@ all, Hi lismore, I write my first "app" and have a little problem with your code maybe you can help me. I get only a error -> Request failed: error hier is my code ->
Url is marke with *** Thx and greets from germany :) |
Hi all, |
Hi mattberg,
your project seems very useful, but I don't have understood how to use it...there is a little tutorial o some instructions somewhere?
thank you
The text was updated successfully, but these errors were encountered: