Parse Android - getCurrentUser() objectId is null

2019-08-09 15:05发布

I'm using ParseTwitterUtils.logIn(..) for logging in the user through twitter. When the callback function is called ParseUser.getCurrentUser().getObjectId() is null.

If the user successfully logged in with twitter shouldn't the current user get an object id assuming that I have a user saved on the server with that same username and twitter authData ?

ParseTwitterUtils.logIn(this, new LogInCallback() {

    @Override
    public void done(ParseUser parseUser, ParseException ex) {
        ParseUser user = ParseUser.getCurrentUser();
        String objectId = user.getObjectId(); //objectId is null

        String loggedInObjectId = parseUser.getObjectId(); //loggedInObjectId is null too
    }
});

Also, ex is null. Meaning the query was executed successfully.

1条回答
爷的心禁止访问
2楼-- · 2019-08-09 15:17

I finally found the problem. If you specify a consumer key in Parse Settings under Settings -> User Authentication Settings, and use different twitter app, Parse won't throw any errors but it will return a ParseUser with empty content.

Make sure you leave the consumer key field blank or use a proper key.

查看更多
登录 后发表回答