pimedia / json-api-user

JSON API User is a plugin, that supports the JSON API Plugin with a new Controller to allow user registration.
http://www.parorrey.com
17 stars 13 forks source link

Generated Authentication Cookie Doesnt work as expected outside the plugin functions #9

Open emmjk opened 6 years ago

emmjk commented 6 years ago

I have been working with the plugin for weeks now and have observed something that might need a change . Generation of authentication cookie : The Plug in has a clear way and direct way of generating the cookie , but if the cookie generated by the plugin is used in the context or environment that wont require plugin code the cookie doesnt work as supposed to . What do i mean is -> If you use browser to create a post using JSON Api plugin , this plugin uses the cookie that is generated automatically by the browser as you must login into your wordpress website for this to work and it will work clearly without any error . But if you now logout from your wordpress site and use cookie generated by this plugin JSON API User the result of the post creation would be

Your 'nonce' value was incorrect. Use the 'get_nonce' API method.

It just wont work , even though with the browser's cookie everything worked . But I cant say that the cookie generated from your plugin is wrong because if it were wrong the result of creating a post from a JSON API plugin could have been

You need to login with a user that has 'edit_posts' capacity.

So try to test your plugin cookie with the create_post method from JSON API and see how you can modify the code for it to work (Post creation) . And if this is to be successful it will now be possible to create a post from any environment - like android application to wordpress website or ios application to wordpress website