Difference between Accounts.onLogin/onLoginFailure and Meteor.loginWithPassword callback?


What exactly is the difference between handling login success/failure in the Meteor.loginWithPassword callback vs using the Accounts.onLogin and Accounts.onLoginFailure methods?


The largest difference is that Acconts.onLogin and Accounts.onLoginFailure methods can be called on the server while Meteor.loginWith<Service> methods can only be called on the client.

With those methods you can create application logic that handles successful/failed login attempts, e.g send a notification email to the user that either he/she or someone else has failed to login to his/hers account five times in a row.
What you do with these hooks are up to you, but they are available if you need them.


Makes sense. Good to have options :slight_smile: Thanks!


Accounts.onLogin works with client also now :smiley: