Cloud functions doesn't accept onLoging by default, how can i "bypass" this limitation so i can run a cloud function every time a user gets "online".

My thought so far is to run a create document on logIn and listen to it, but what happens when the user is not login in but using his last time session? 

Do i run the same post request on the isLogged function ? that function can be run many times when the application is running, so is not optimal. 

is running the function on app init (angular 7) the solution here?