我已经在我的Android应用程序中集成了Quickblox SDK V2.2.5,我发现当我们使用Facebook和Twitter等SocialProviders
时,聊天不起作用。
因此,当我们尝试登录时,会发生不让它工作的确切错误 ChatService
,在收到 Quickblox 所有必需的单例类的成功之后。
这是我的代码:-
QBAuth.createSession(new QBEntityCallbackImpl<QBSession>() {
@Override
public void onSuccess(final QBSession result, Bundle params) {
Log.e("QbAuth/onSuccess", "" + result);
QBUsers.signInUsingSocialProvider(QBProvider.FACEBOOK, preference.getFacebookToken(), null, new QBEntityCallbackImpl<QBUser>() {
@Override
public void onSuccess(final QBUser user, Bundle args) {
Log.e("Fb Login/onSuccess", "user: " + user.toString());
try {
user.setPassword(BaseService.getBaseService().getToken());
} catch (BaseServiceException e) {
e.printStackTrace();
// means you have not created a session before but we have created as we can see.
}
// Lets initialize ChatService if it's not done before.
ChatService.initIfNeed(context);
ChatService.getInstance().login(user, new QBEntityCallbackImpl() {
@Override
public void onSuccess() {
Log.e("ChatService/onSuccess",
"Logged in to Chat");
}
@Override
public void onError(final List errors) {
/** It's always been error here while we login **/
Log.e("ChatService Error", "" + errors);
}
});
}
});
try {
// User & password saving.
DataHolder.getDataHolder().setSignInQbUser(
user);
DataHolder
.getDataHolder()
.setSignInUserPassword(
BaseService
.getBaseService()
.getToken());
} catch (BaseServiceException e) {
e.printStackTrace();
}
}
@Override
public void onError(List<String> errors) {
Log.e("Fb Login/onError", "Error: "
+ errors);
}
});
}
@Override
public void onError(List<String> errors) {
Log.e("QbAuth/onError", "" + errors);
}
});
相同的日志是:-
01-20 12:18:37.657 28040-28040/com.myapp D/QBASDK: POST https://api.quickblox.com/session.json?application_id=25290&auth_key=Mr3GJxYk6krKbQN&nonce=-1682323378×tamp=1453272517&user[login]=_702514376540831&user[email]=haps%40india.com&user[password]=3731b3f7f4857202ce39516d677baf54bfbbd3aa&signature=6a5c8f377906d5e73852e838b488ef500c499bef
*** RESPONSE *** a35fe359-229b-4663-b705-67d9e394eb7e ***
01-20 12:18:39.187 28040-28040/com.myapp D/QBASDK: STATUS : 422
01-20 12:18:39.187 28040-28040/com.myapp D/QBASDK: HEADERS
01-20 12:18:39.187 28040-28040/com.myapp D/QBASDK: Access-Control-Allow-Origin=*
01-20 12:18:39.187 28040-28040/com.myapp D/QBASDK: Cache-Control=no-cache
01-20 12:18:39.187 28040-28040/com.myapp D/QBASDK: Connection=keep-alive
01-20 12:18:39.187 28040-28040/com.myapp D/QBASDK: Content-Length=44
01-20 12:18:39.187 28040-28040/com.myapp D/QBASDK: Content-Type=application/json; charset=utf-8
01-20 12:18:39.187 28040-28040/com.myapp D/QBASDK: Date=Wed, 20 Jan 2016 06:48:38 GMT
01-20 12:18:39.187 28040-28040/com.myapp D/QBASDK: QuickBlox-REST-API-Version=0.1.1
01-20 12:18:39.187 28040-28040/com.myapp D/QBASDK: Server=nginx/1.8.0
01-20 12:18:39.187 28040-28040/com.myapp D/QBASDK: Status=422 Unprocessable Entity
01-20 12:18:39.187 28040-28040/com.myapp D/QBASDK: X-Rack-Cache=invalidate, pass
01-20 12:18:39.187 28040-28040/com.myapp D/QBASDK: X-Request-Id=102f5ea405e66ba568a7a5f5522b65de
01-20 12:18:39.187 28040-28040/com.myapp D/QBASDK: X-Runtime=0.006373
01-20 12:18:39.187 28040-28040/com.myapp D/QBASDK: X-UA-Compatible=IE=Edge,chrome=1
01-20 12:18:39.187 28040-28040/com.myapp D/QBASDK: BODY
01-20 12:18:39.187 28040-28040/com.myapp D/QBASDK: '{"errors":{"base":["Unexpected signature"]}}'
01-20 12:18:39.187 28040-28040/com.myapp E/ChatService Error: [base Unexpected signature]
看起来您正在尝试使用用户的参数(如登录名、密码和电子邮件)创建会话
您可以选择一个身份参数(登录名或电子邮件)并尝试使用它吗,不需要同时传递它们