Yes it's true.
Each time you open a new page, you are not logged in. When the localStorage token authenticates you, just like a cookie does, you register automatically. This hook also starts when you log in automatically.
It is difficult to determine how the user logs on. Meteor Meteor onLogin fires with any type of login method.
You can configure when you want your hook to start:
Accounts.onLogin(function(info) { if(info.methodName == "createUser") { console.log("This user logged in by signing up"); }else if(info.type == "password") { console.log("This user logged in by using his/her password"); }else if(info.type == "resume") { console.log("This user logged in using a localStorage token"); } });
Thus, you can make an event fire only when the user logs in using his password. Or even when they subscribe. You can use this to prevent your hook from starting if the user opens a new page that uses the localStorage token to register.
Akshat
source share