Firebase – Can Cloud Functions for Firebase execute on user login

firebasegoogle-cloud-functions

I see how execute a Cloud Function on user account creation:

exports.myFunction = functions.auth.user().onCreate(event => { 

But I need my function to execute when the user logs in. Is there a onLogin trigger?

And can someone with 1500 points create a tag for firebase-cloud-functions?

Best Answer

There's no event for login, because only the client side can define exactly when a login happens. Different clients may define this in different ways. If you need to trigger something on login, figure out when that point is in your app, then trigger it from the client via a database or HTTP function.