首页 > 解决方案 > 解析服务器如何在 logInWithInBackground 后获取 AuthenticationCallback?

问题描述

调用 logInWithInBackground 后如何获得回调?目前我正在使用下面的代码进行登录,但不知道如何获得成功结果。

Task<ParseUser> parseUserTask = ParseUser.logInWithInBackground("facebookaccountkit", authData);

我想在成功登录后将用户发送到另一个活动。

api链接:

https://parseplatform.org/Parse-SDK-Android/api/com/parse/ParseUser.html#logInWithInBackground-java.lang.String-java.util.Map-

https://parseplatform.org/Parse-SDK-Android/api/com/parse/AuthenticationCallback.html

标签: androidparse-platformparse-serveraccount-kit

解决方案


您可以使用延续:

parseUserTask.continueWith(new Continuation<ParseUser, Void>() {
            @Override
            public Void then(bolts.Task<ParseUser> task) {

                if(task.isCancelled()){
                    showError();
                    return null;
                }
                if (task.isFaulted()){
                    showError();
                    return null;
                }

                final ParseUser user = task.getResult();
                //do something with the user
                return null;
            }
        });

这取自Google OAuth 配置


推荐阅读