使用 quickblox android 获取 "base unexpected signature"
Getting "base unexpected signature" using quickblox android
我正在使用 QuickBlox 开发 android 应用程序。我正在使用此代码:
SmackAndroid.init(BaseFragmentActivity.this);
QBSettings.getInstance().fastConfigInit(String.valueOf(Utility.APP_ID), Utility.AUTH_KEY, Utility.AUTH_SECRET);
// Create QuickBlox session
//
if(tcApp.hasConnection()) {
final QBUser qbUser = new QBUser(userId, userPassword);
QBAuth.createSession(qbUser, new QBEntityCallbackImpl<QBSession>() {
@Override
public void onSuccess(QBSession qbSession, Bundle bundle) {
Log.d("TAG", "HERE");
}
@Override
public void onError(List<String> errors) {
Log.d("TAG", "HERE");
}
});
}
我的要求是:
REQUEST
POST https://api.quickblox.com/session.json
HEADERS
QuickBlox-REST-API-Version=0.1.1
QB-SDK=Android 0.0.0
PARAMETERS
application_id=20586
auth_key=ffwM7kHMfYeBZJw
nonce=673123212
timestamp=1425984798
user[login]=qbtest@gmail.com
user[password]=icreon123#
signature=0feedd9d0a0a7b2580eb3df5e7993af8873d345f
我的回复在这里:
STATUS : 422
HEADERS
Access-Control-Allow-Origin=*
Cache-Control=no-cache
Connection=keep-alive
Content-Type=application/json; charset=utf-8
Date=Tue, 10 Mar 2015 10:53:21 GMT
QuickBlox-REST-API-Version=0.1.1
Server=nginx/1.0.15
Status=422 Unprocessable Entity
Transfer-Encoding=chunked
X-Rack-Cache=invalidate, pass
X-Request-Id=550eb9d6d2d547059ace197abfc4159c
X-Runtime=0.006233
X-UA-Compatible=IE=Edge,chrome=1
BODY
'{"errors":{"base":["Unexpected signature"]}}'
我已经检查了所有的参数,看起来没问题。我使用的是 Quickblox 2.0,这里有什么问题吗?请提出建议。
如果您在此处进行注册,请在从以下代码创建会话时删除 qbUser
。
QBAuth.createSession(qbUser, new QBEntityCallbackImpl<QBSession>() {
@Override
public void onSuccess(QBSession qbSession, Bundle bundle) {
Log.d("TAG", "HERE");
}
@Override
public void onError(List<String> errors) {
Log.d("TAG", "HERE");
}
});
它应该看起来像这样
QBAuth.createSession(new QBEntityCallbackImpl<QBSession>() {
@Override
public void onSuccess(QBSession qbSession, Bundle bundle) {
// sign up to Chat
QBUsers.signUp(user, new QBEntityCallbackImpl<QBUser>() {
@Override
public void onSuccess(QBUser user, Bundle args) {
callback.onSuccess();
}
@Override
public void onError(List<String> errors) {
callback.onError(errors);
}
});
}
@Override
public void onError(List<String> errors) {
Log.d("TAG", "HERE");
}
});
编辑
如果您正在登录,如果您在用户对象
中发送 Login
和 Password
以外的额外参数,则会遇到此错误
我正在使用 QuickBlox 开发 android 应用程序。我正在使用此代码:
SmackAndroid.init(BaseFragmentActivity.this);
QBSettings.getInstance().fastConfigInit(String.valueOf(Utility.APP_ID), Utility.AUTH_KEY, Utility.AUTH_SECRET);
// Create QuickBlox session
//
if(tcApp.hasConnection()) {
final QBUser qbUser = new QBUser(userId, userPassword);
QBAuth.createSession(qbUser, new QBEntityCallbackImpl<QBSession>() {
@Override
public void onSuccess(QBSession qbSession, Bundle bundle) {
Log.d("TAG", "HERE");
}
@Override
public void onError(List<String> errors) {
Log.d("TAG", "HERE");
}
});
}
我的要求是:
REQUEST
POST https://api.quickblox.com/session.json
HEADERS
QuickBlox-REST-API-Version=0.1.1
QB-SDK=Android 0.0.0
PARAMETERS
application_id=20586
auth_key=ffwM7kHMfYeBZJw
nonce=673123212
timestamp=1425984798
user[login]=qbtest@gmail.com
user[password]=icreon123#
signature=0feedd9d0a0a7b2580eb3df5e7993af8873d345f
我的回复在这里:
STATUS : 422
HEADERS
Access-Control-Allow-Origin=*
Cache-Control=no-cache
Connection=keep-alive
Content-Type=application/json; charset=utf-8
Date=Tue, 10 Mar 2015 10:53:21 GMT
QuickBlox-REST-API-Version=0.1.1
Server=nginx/1.0.15
Status=422 Unprocessable Entity
Transfer-Encoding=chunked
X-Rack-Cache=invalidate, pass
X-Request-Id=550eb9d6d2d547059ace197abfc4159c
X-Runtime=0.006233
X-UA-Compatible=IE=Edge,chrome=1
BODY
'{"errors":{"base":["Unexpected signature"]}}'
我已经检查了所有的参数,看起来没问题。我使用的是 Quickblox 2.0,这里有什么问题吗?请提出建议。
如果您在此处进行注册,请在从以下代码创建会话时删除 qbUser
。
QBAuth.createSession(qbUser, new QBEntityCallbackImpl<QBSession>() {
@Override
public void onSuccess(QBSession qbSession, Bundle bundle) {
Log.d("TAG", "HERE");
}
@Override
public void onError(List<String> errors) {
Log.d("TAG", "HERE");
}
});
它应该看起来像这样
QBAuth.createSession(new QBEntityCallbackImpl<QBSession>() {
@Override
public void onSuccess(QBSession qbSession, Bundle bundle) {
// sign up to Chat
QBUsers.signUp(user, new QBEntityCallbackImpl<QBUser>() {
@Override
public void onSuccess(QBUser user, Bundle args) {
callback.onSuccess();
}
@Override
public void onError(List<String> errors) {
callback.onError(errors);
}
});
}
@Override
public void onError(List<String> errors) {
Log.d("TAG", "HERE");
}
});
编辑
如果您正在登录,如果您在用户对象
中发送Login
和 Password
以外的额外参数,则会遇到此错误