Search code examples
parse-platform

Parse for javascript - "error 209 invalid session token" when signing up a new user


I wrote a simple function in an angularJS application for signing up new users:

$scope.registerUser = function(username, password) {
    var user = new Parse.User();
    user.set("username", username);
    user.set("email", username);
    user.set("password", password);

    user.signUp(null, {
      success: function(result) {

        console.log(result);
        $scope.registerUserSuccess = true;
        $scope.registerUserError = false;
        $scope.registerUserSuccessMessage = "You have successfully registered!";

        $scope.$apply();

        $timeout(function(){
            $state.go("user");
        }, 1000);

      },
      error: function(user, error) {
        $scope.registerUserError = true;
        $scope.registerUserSuccess = false;
        $scope.registerUserErrorMessage = "Error: [" + error.code + "] " + error.message;
        $scope.$apply();
      }
    });

Initially it worked fine, but when I deleted all the users directly through Parse.com, I can't sign up new users using this function anymore. Each time I get error 209 invalid session token. Here's a screenshot of my Parse database:

enter image description here

I've googled the error message and the solution is always to log out the current user. However, if no users exist this isn't an action I can possibly take.

So I would not only like to fix this problem, but also know how to prevent it in the future so my application can be used safely.

Edit: I created a user directly in Parse.com, wrote a function to log in that user, but got the same error. I am completely stuck until this session issue is resolved.


Solution

  • delete all your session tokens, and anything else Parse related really, from local storage:

    enter image description here

    if needed turn off legacy session tokens, and follow migration tutorial from scratch:

    enter image description here