Not getting Meteor.userId() after page load


#1

Meteor account disconnected while page refresh in accounts-ui package. I am checking Meteor.userId() on Flow routing.

appRoute.route(’/setting’, {
name: ‘setting’,
triggersEnter: [function(context, redirect) {
console.log(">>> “,Meteor.user()) //it returns undefined after page refresh
if(!Meteor.user()){
console.log(”===")
redirect(‘home’);
}
}],
action() {
mount(Home, {
main: ,
});
}
});


#2

It takes a while to log in the user after a hard page load, you can check it with:

if (Meteor.loggingIn()) {
                this.render('loading');
            }
            else

#3

Meteor.loggingIn() returns false and not working with it.


#4

You mean Meteor.loggingIn() returns false and Meteor.user() is undefined at the same time?
If you, after that, type Meteor.user() in the console and get a user object, something is wrong…