Start a new topic

Why is the activeUser null even though I am logged in?

I am using the following code to get the active user, however user is null even though I am logged in.



Kinvey.init({

appKey : 'App Key',

appSecret : 'App Secret'

});

var activeUser = Kinvey.getActiveUser();

// Do stuff with the activeUser.

I have the same Problem here, and this code didn't work for me 
can you help me ? :) 

The active user is restored asynchronously as part of the `Kinvey.init` call. The following will return the activeUser:



Kinvey.init({

appKey : 'App Key',

appSecret : 'App Secret'

}).then(function(activeUser) {

// Do stuff with the activeUser.

}, function(error) {

// An error occured.

});



Or, if you are using traditional callbacks:



Kinvey.init({

appKey : 'App Key',

appSecret : 'App Secret',

success : function(activeUser) {

// Do stuff with the activeUser.

},

error : function(error) {

// An error occured.

}

});
Login or Signup to post a comment