com.parse.ParseRequest $ ParseRequestException:无效的会话令牌异常

时间:2017-12-11 20:37:19

标签: android database parse-platform

我正在尝试在ParseUser数据库上放置数据并登录用户,但我得到异常“无效会话令牌”。我不确定user.put("fullname", fullname);

 signIn.setOnClickListener(new View.OnClickListener() {
        @Override


        public void onClick(View view) {


            final String email, fullname, username, password;
            email = emailEditText.getText().toString();
            fullname = nameEditText.getText().toString();
            username = usernaEditText.getText().toString();
            password = passEditText.getText().toString();

            if (!(email.isEmpty() || fullname.isEmpty() || username.isEmpty() || password.isEmpty())){
                ParseUser user = new ParseUser();

                user.put("fullname", fullname);
                user.setEmail(email);
                user.setUsername(username);
                user.setPassword(password);


                user.signUpInBackground(new SignUpCallback() {
                    @Override
                    public void done(ParseException e) {

                       if (e == null){
                        Toast.makeText(SignUpActivity.this, "Sign up successful", Toast.LENGTH_SHORT).show();
                    }else {
                           if(e.getCode() == 202){
                               emailEditText.setText("");
                               nameEditText.setText("");
                               usernaEditText.setText("");
                               passEditText.setText("");
                           }
                           Toast.makeText(SignUpActivity.this, "Sign up failed "+ e.toString(), Toast.LENGTH_LONG).show();
                        }
                    }

                });

This is the exception that the Toast shows

1 个答案:

答案 0 :(得分:0)

我有这个,只需要注销当前用户,只需将代码放在ParseUser user = new ParseUser();之前

ParseUser currentUser = ParseUser.getCurrentUser(); currentUser.logOut();