我一直在使用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); } } } });