获得"基于意外签名"使用quickblox android

时间:2015-03-10 11:05:45

标签: android quickblox

我正在使用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。请建议。

1 个答案:

答案 0 :(得分:2)

如果您在此处进行注册,请在从以下代码创建会话时删除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");
            }
        });

修改

如果您正在登录,您将面临此错误,以防您在用户对象中发送LoginPassword以外的其他参数