Search code examples
quickblox

Getting not-authorized xmpp error on creating video chat


I'm able to successfully setup quickblox and successfully create sessions and authenticate users, however as soon as I want to create a chat, I receive the following log erors:

2015-09-02 18:39:10.881 banter[4518:2302588] -[QBChat xmppStreamDidConnect:] -> Trying TLS...

2015-09-02 18:39:11.523 banter[4518:2302588] -[QBChat xmppStreamDidSecure:] -> isSecure: YES

2015-09-02 18:39:11.703 banter[4518:2302553] xmppStreamDidConnect

2015-09-02 18:39:11.800 banter[4518:2302554] QBChat/didNotAuthenticate, error:

2015-09-02 18:39:11.805 banter[4518:2302554] -[QBChat xmppStreamDidDisconnect:withError:] -> error: (null)

which seems as though there is something wrong with my account. In order to test this theory, I downloaded the sample app quickblox provides, ensured it runs (it does) and then changed the credentials in the sample app to my own (all 4 places -- app id, auth id, secret id, account id) and when rerunning it I got the same error.

Is there something I need to setup with my account to make this work?


Solution

  • I've figured it out -- the authentication via my account forces me to use users by ID rather than user name (not sure exactly why this is,) so the old code which looked like:

    var user = QBUUser()
    user.login = "test2"
    user.password = __REDACTED__
    let resp = QBChat.instance().loginWithUser(user)
    

    The new code looks like:

    var user = QBUUser()
    user.ID = 5144362
    user.password = __REDACTED__
    let resp = QBChat.instance().loginWithUser(user)
    

    and now login proceeds correctly.

    (N.B. Got the idea for trying ID from this answer: Quick blox chat not authenticating)