6

我一直在使用 quickblox 网站上的代码示例,但是我收到以下错误:

signIn error: Token is required

我的代码:

QBSettings.getInstance().fastConfigInit(APP_ID, AUTH_KEY, AUTH_SEC);
    QBAuth.createSession("test", "test",new QBCallbackImpl() {
        @Override
        public void onComplete(Result result) {
            if (result.isSuccess()) {
                // result comes here if authorization is success
                Log.d(TAG,"createSession success");
                QBSessionResult qbSessionResult = (QBSessionResult) result;
            }else{
                for(String s: result.getErrors()){
                    Log.d(TAG, "createSession error: " +s);
                }
            }
        }
        });

             //getting error in here
     QBUsers.signIn("test","test", new QBCallbackImpl() {
                    @Override
                    public void onComplete(Result result) {
                        if (result.isSuccess()) {
                            Log.d(TAG,"signIn success");
                            QBUserResult qbUserResult = (QBUserResult) result;
                        } else {
                            for(String s: result.getErrors()){
                                Log.d(TAG, "signIn error: " +s);
                            }
                        }
                    }
                });

会话已成功创建,并且用户“test”在应用程序下的 quickblox 仪表板上存在密码“test”。

请告知我做错了什么?

4

1 回答 1

6

您必须在会话创建后调用 QBUsers.signIn

    QBSettings.getInstance().fastConfigInit(APP_ID, AUTH_KEY, AUTH_SEC);
    QBAuth.createSession("test", "test",new QBCallbackImpl() {
        @Override
        public void onComplete(Result result) {
            if (result.isSuccess()) {

                QBUsers.signIn("test","test", new QBCallbackImpl() {
                    @Override
                    public void onComplete(Result result) {
                        if (result.isSuccess()) {
                            Log.d(TAG,"signIn success");
                            QBUserResult qbUserResult = (QBUserResult) result;
                        } else {
                            for(String s: result.getErrors()){
                                Log.d(TAG, "signIn error: " +s);
                            }
                        }
                    }
                });


            }else{
                for(String s: result.getErrors()){
                    Log.d(TAG, "createSession error: " +s);
                }
            }
        }
        });
于 2013-04-19T09:54:36.450 回答