- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13
Description
Hi there,
I am trying to create a post using jSON Api and jSON Api User.
My username is administrator so should be ok and Password does not have & or # in it.
Here's what I am doing:
var nonce = jQuery.getJSON( "https://www.example.com/api/get_nonce?json=get_nonce&controller=posts&method=create_post" );
console.log(nonce);
// ATTENTION: cookie was created on a login page and stored at localStorage.
var dataString = "controller=posts&method=create_post&cookie=" + localStorage.getItem("cookie") + "&nonce=" + nonce.responseJSON.nonce + "&post_type=my-custom-type&title=Post Created by APP";
console.log(dataString);
jQuery.ajax({
type: "GET",
url:"https://www.example.com/api/posts/create_post?",
data: dataString,
crossDomain: true,
cache: false,
success: function(data){
console.log(JSON.stringify(data));
},
error: function(data){
console.log(JSON.stringify(data));
}
});
I am getting back this error:
{"readyState":4,"responseText":"{\"status\":\"error\",\"error\":\"Your 'nonce' value was incorrect. Use the 'get_nonce' API method.\"}","responseJSON":{"status":"error","error":"Your 'nonce' value was incorrect. Use the 'get_nonce' API method."},"status":403,"statusText":"Forbidden"}
Any Ideas on how to solve this?
Thanks.