简体   繁体   中英

'POST 400 bad request' error during log in parse.com

i am doing website and using parse.com as a server. i did a login form and wrote login function in javascript. it worked correctly login button redirected me to profile page, but sometimes after I've got an error message 'POST 400 bad request' and below it I got this one 'Log in Error:invalid session token' . I have no idea what's going on. I tried to login on different computer and it was successful.

UPDATE

   function parlogin(){
  var name = $("#name").val(); 
  var pass = $("#password").val();

  Parse.User.logIn(name, pass, {
    success: function(user){


     window.location.href="login/login.html";
    alert("success");
      console.log("everything OK")
    return true;
    },
    error: function(user, error) {
    alert("error");
      console.log("Log in Error:"+error.message);
      return false;
    }
  });

};

var login = document.querySelector('#parslogin');
login.onclick = parlogin;

After the login is OK and you do other actions to parse you are somehow getting a stale/bad token used in the Operation to parse.

Below is curl sample from a using stale token in a GET...

< HTTP/1.1 400 Bad Request
< Access-Control-Allow-Methods: *
< Access-Control-Allow-Origin: *
< Content-Type: application/json; charset=utf-8
< Date: Wed, 20 Jan 2016 09:54:52 GMT
< Server: nginx/1.6.0
< X-Parse-Platform: G1
< X-Runtime: 0.034887
< Content-Length: 45
< Connection: keep-alive
< 
{"code":209,"error":"invalid session token"}
* Connection #0 to host api.parse.com left intact
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM