Most secure way to check if a user is logged in?


#1

Is there a preference of checking Meteor.user() vs Meteor.userId()? I’m using Flow Router, in this case.

let userDashboard = FlowRouter.group({
  prefix: '/user/dashboard',
  name: 'userArea',
  triggersEnter: [function (context, redirect) {
    if (!Meteor.user()) {
      FlowRouter.go('/user/login');
    }
  }]
});

#2

I heard that .userId() is faster.
And as we are talking about client side, there is no “secure”.