quickblox error when login, android

2019-05-10 22:59发布

问题:

I'm using quickblox for a chat on android platform, with facebook auth, I do these steps such

1)QBSettings.getInstance().fastConfigInit(..,..,..)
2)QBAuth.createSession(this, QBQueries.QB_QUERY_AUTHORIZE_APP)
3)SmackAndroid.init(this)

4)facebook login and get a accesstoken

5)QBUsers.signInUsingSocialProvider(QBProvider.FACEBOOK, accessToken, null, this)
6)QBChatService.getInstance().loginWithUser

but i have a error: (error when login: SASL authentication failed) I don't know why. can you help me? thanks a lot

回答1:

This is an issue with Chat login

6)QBChatService.getInstance().loginWithUser

If you do facebook login - you should use qb token as a password for Chat http://quickblox.com/developers/Chat#Password

For example:

// init test user
qbUser = new QBUser();
qbUser.setId(ApplicationConfig.testUserID1);
try {
    qbUser.setPassword(BaseService.getBaseService().getToken());
} catch (BaseServiceException e) {
    e.printStackTrace();
}


回答2:

I had a hard time figuring out the issue. In my case I was using ChatService class instead of QBChatService for FB/Twitter login.