How to manage a quickblox Javascript SDK session

I managed to create a quickblox session and it works when going from one page to another. But as soon as the web application is updated, the session will be lost and I will have to initialize the authentication key again, etc.

I tried to save the token obtained when creating the session and initialize the quickblox object using this token, but it gives an error saying that I need to provide an authentication key, etc. Which in accordance with their documentation should have worked.

I was wondering if there is a more efficient way to manage the session? I do not like when you need to reinitialize a session every time the application is updated. Any pointers would be appreciated. I usually save session details to local storage using the db package. The application is an angular js application using ui-router. I use the stateprovider start function to initialize the qb object, but first check if an existing session exists.

LcDb.get session().then(
  function(res){
     Qb.init(res.token);
  },
  function(err){ 
     Var config = {
              on: {
                sessionExpired:function(next,retry){

                 }
                }
             QB.init(app.Id,app.key,app.secret,config);
              })
        QB.create session(function(err,result){
+4
source share
1 answer

, , , , QB.chat , QB.chat , , ( , , , ), ( ).
angular js, app.js , .
, QB.chat , .

, .

0

Source: https://habr.com/ru/post/1609211/


All Articles