Parse Android - getCurrentUser() objectId is null after twitter login

三世轮回 提交于 2020-01-05 12:12:14

问题


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:


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.



来源:https://stackoverflow.com/questions/24443704/parse-android-getcurrentuser-objectid-is-null-after-twitter-login

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!