com.parse.ParseRequest$ParseRequestException: invalid session token

前端 未结 3 1561
抹茶落季
抹茶落季 2020-12-21 10:37

Hello I am working on android app in which I am using parse cloud. I have signUp into the system then after I am trying to fetch data from parse.

But I am getting an

相关标签:
3条回答
  • 2020-12-21 11:13

    As Yurets said, you probably removed the session object. This can be solved quickly by uninstalling the app and then re-installing it.

    0 讨论(0)
  • 2020-12-21 11:22

    I got this error when I was trying to login while I already logged in. Try to call ParseUser.logout()

    0 讨论(0)
  • 2020-12-21 11:28

    Googling and Parse docs didn't give too much info about this exception, but There are few common mistakes I found. You should treat users as ParseUser, not ParseObject.

    ParseQuery<ParseUser> query = ParseUser.getQuery();
    

    One more case: need to specify what to find in background. If it is username, so write:

    parseQuery.whereEqualTo("username", userName);
    

    And finally callback will contain List with ParseUsers, not ParseObjects

    query.findInBackground(new FindCallback<ParseUser>() {
      public void done(List<ParseUser> objects, ParseException e) {
      }
    });
    

    I'm not sure exception will be gone, but I hope this answer will be useful anyways.

    Some useful links: doc with example, answer, Doc for class ParseQuery with examples

    UPDATE

    This is the official doc how to handle this error, also as I commented try to use ParseUser.enableRevocableSessionInBackground() after Parse.initialize(); According to the SDK Documentation it is gonna update session token and only one case it could be invalid - ParseObject was removed. Hope that helps.

    0 讨论(0)
提交回复
热议问题