Skip to content

QB.chat.connect often returning password error when password is correct. #19

@Femtosecond

Description

@Femtosecond

I'm getting a strange error a lot of the time with error code

199 408872 log stringifying the err... {"code":401,"status":"error","message":"Unauthorized","detail":"Status.AUTHFAIL - The authentication attempt failed"}
Password not verified

But the problem is that the password is definitely correct. It works some of the time, and always logs into QB successfully before the QB.chat server, so I know thats not the problem.

Here is the code:

  QB.users.create(params, function(err, user){
    if (user) {
      console.log("successful user.create... " + JSON.stringify(user));
      var jid = user.id + "-24325" + "@chat.quickblox.com";
      console.log(user.login + "'s jid is......" + jid);
      var chatparams = {'jid': jid, 'password': ($scope.user.password)};
      QB.chat.connect(chatparams, function(err, roster) {
        console.log("err from qb.chat.connect... " + JSON.stringify(err));
        console.log("roster from qb.chat.connect .... " + JSON.stringify(roster));
      });
    } 
    else  {
      console.log(JSON.stringify(err));
      if (err.message == "Unprocessable Entity"){
        QB.login(params, function(err, user){
          if (user) {
            console.log("Logged into QB with " + JSON.stringify(user));
            var jid = user.id + "-24325" + "@chat.quickblox.com";
            console.log(user.login + "'s jid is......" + jid);
            var chatparams = {'jid': jid, 'password': ($scope.user.password)};
            QB.chat.connect(chatparams, function(err, roster) {
              console.log("stringifying the err... " + JSON.stringify(err));
              console.log("stringifying the roster... " + JSON.stringify(roster));
            });
          } 
          else  {
            console.log(JSON.stringify(err));
          }
        });
      }
    }
  });

Can't figure out what the problem would be.. We are trying to use this for a large project so there will be business down the line, but not if we can't get this working right. I'm also wondering if this is because we are on the free plan right now, which I noticed gives no guarantee of uptime.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions