title: Quickblox sigBytes error - authentication for chat
body: <p>Another quickblox question - I am getting the following error when trying to run my application:</p>
  
  <pre><code>Uncaught TypeError: Cannot read property 'sigBytes' of undefinedquickblox.js:10707 c.HMAC.i.extend.initquickblox.js:10703 i.Hasher.a.extend._createHmacHelperquickblox.js:101 signMessagequickblox.js:35 createSessionquickblox.js:867 QuickBlox.createSessionchat.html:122 (anonymous function)
  </code></pre>
  
  <p>This error prevents successful authentication of the user. The code being executed is below(insecure as hell - proof of concept only!):</p>
  
  <pre><code>var chatToUser = window.localStorage.getItem("chatToUser");
          var username = window.localStorage.getItem("user");
          var password = window.localStorage.getItem("pwd");
          var params = {login:username,password:password};
  
      console.log("PARAMS: ",params);
  
      $(document).ready(function(){
          var chatService = new QBChat(params);
      });
  
      // JavaScript SDK initialization
      QB.init(QBAPP.appID, QBAPP.authKey, QBAPP.authSecret);
  
      // QuickBlox session creation
      QB.createSession(params, function(err, result) {
          if (err) {
                  console.log("ERROR:", err.detail);
          } else {
                  chatUser = {
                      id: result.user_id,
                      pass: params.password
                  };
  
                  connectChat();
          }
      });
  
      function connectChat() {
          chatService = new QBChat({
                  onConnectFailed: onConnectFailed,
                  onConnectSuccess: onConnectSuccess,
                  onConnectClosed: onConnectClosed,
                  onChatMessage: onChatMessage
          });
  
          console.log("Chat Service: ", chatService);
          console.log("Chat User: ", chatuser);
          // connect to QB chat service
          chatService.connect(chatUser);
      }
  
      /* Callbacks
      ------------------------------------------------------*/
      // Connection is failed
      function onConnectFailed() {
          alert("We're having some difficulty talking to the server. Please try again later, or get in touch if th eproblem persists.")
      }
  
      // Connection is success
      function onConnectSuccess() {
          //green dot - live - status
          alert("Connected.")
      }
  
      // Connection is closed
      function onConnectClosed() {}
  </code></pre>
  
  <p>What do i need to do differently in order to successfully log the user in for chat?</p>
  
  <p>If it helps, I have previously generated a session for them based on their 'user' credentials (username/password). Is it possible to simply reuse this session instead of creating a fresh one?</p>