I am working on android app using QuickBlox. I am using this code:
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");
}
});
}
My Request is:
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
and my response is here:
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"]}}'
I have checked all the params and seems fine . Is there something wrong here I am using Quickblox 2.0. Please suggest.
If you are doing registration here remove qbUser
while creating session from below code.
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");
}
});
It should look something like this
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");
}
});
EDIT
If you are doing Login you will face this error in case you are sending extra parameters other than Login
and Password
in User object