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?
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);
}
}
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With