Hi, I've been working on a plancast app for android based on the
phonegap framework. (apps build in html, javascript, css)
Everything works fine except that I've some problems with the
verify_credentials API.
When the verify_credentials succeed the first time, the session stays
open, so if I try to run the verify_credentials again with another
login/password, the information of the first user are returned. I
don't know how to process a "logout" without restarting the browser.
(which is something I can't do on the android)
Here is my code:
var xhr;
var url = '
http://api.plancast.com/02/account/
verify_credentials.json;
xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.setRequestHeader("Cache-Control", "no-cache, must-revalidate");
xhr.setRequestHeader("Pragma", "no-cache");
xhr.setRequestHeader("Authorization","Basic " + btoa(user_login
+":"+user_password));
xhr.onreadystatechange = function(){
if (xhr.readyState == 4) {
alert(xhr.responseText);
}
};
xhr.send(null);
I was thinking that
xhr.setRequestHeader("Cache-Control", "no-cache, must-revalidate")
would fix the problem but apparently not.
So my question is: does the API checks all the header info? Is there
something wrong in my code?
Thank you.