According to the docs, Accounts.onLogin allows for a registering a callback after a login attempt succeeds.
However, in reality, Accounts.onLogin gets called not just after a user signs in, but for every page request thereafter until they sign out. Why?
This makes it hard to use this method for something specific to just a login event (such as redirecting back to the originally requested page.)
Why this is happening? How I can can prevent it from happening? I want to only call this once after a user signs in.
To see an example, and the code that triggers this issue, please see the following repo: https://github.com/andersr/meteor-accounts-login-test
- While anonymous, the function is not called.
- After signing in, it gets called with every new page request.