Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Cloud Functions for Firebase execute on user login?

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?

like image 692
Thomas David Kehoe Avatar asked Sep 27 '17 16:09

Thomas David Kehoe


People also ask

What are Firebase cloud functions used for?

Cloud Functions for Firebase is a serverless framework that lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests. Your JavaScript or TypeScript code is stored in Google's cloud and runs in a managed environment.

What is the difference between cloud run and cloud function?

Cloud Functions lets you deploy snippets of code (functions) written in a limited set of programming languages, while Cloud Run lets you deploy container images using the programming language of your choice.


1 Answers

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.

like image 164
Doug Stevenson Avatar answered Oct 10 '22 16:10

Doug Stevenson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!