android – QuickBlox令牌是必需的错误

前端之家收集整理的这篇文章主要介绍了android – QuickBlox令牌是必需的错误前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我一直在使用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",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”存在.

请告诉我我做错了什么?

解决方法

你必须在创建会话后调用QBUsers.signIn
QBSettings.getInstance().fastConfigInit(APP_ID,new QBCallbackImpl() {
        @Override
        public void onComplete(Result result) {
            if (result.isSuccess()) {

                QBUsers.signIn("test","signIn error: " +s);
                            }
                        }
                    }
                });


            }else{
                for(String s: result.getErrors()){
                    Log.d(TAG,"createSession error: " +s);
                }
            }
        }
        });
原文链接:https://www.f2er.com/android/309556.html

猜你在找的Android相关文章