QuickBlox Token is required error
Asked Answered
S

1

6

I have been using the code examples from the quickblox website however i am getting the following error:

signIn error: Token is required

My code:

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","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);
                            }
                        }
                    }
                });

The session is created succcessfully and the user "test" exists with the password "test" on the quickblox dashboard under the application.

Please advise what i am doing wrong?

Subtangent answered 18/4, 2013 at 17:2 Comment(0)
M
6

YOu have to call QBUsers.signIn after session creation

    QBSettings.getInstance().fastConfigInit(APP_ID, AUTH_KEY, AUTH_SEC);
    QBAuth.createSession("test", "test",new QBCallbackImpl() {
        @Override
        public void onComplete(Result result) {
            if (result.isSuccess()) {

                QBUsers.signIn("test","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);
                            }
                        }
                    }
                });


            }else{
                for(String s: result.getErrors()){
                    Log.d(TAG, "createSession error: " +s);
                }
            }
        }
        });
Muniz answered 19/4, 2013 at 9:54 Comment(1)
But, if I want to use API to check if a email is registered or not, I can't sign in then.Strobila

© 2022 - 2024 — McMap. All rights reserved.