new Firebase Authentication trigger
firebase currently has two firebase auth triggers:
functions.auth.user().onCreate()
functions.auth.user().onDelete()
I would like a trigger to respond to onLinkWithCredential so that I can update the user document in the user collection with the additional/changes from the new auth method
-
Alex Mamo commented
Yes, the functions.auth.user().onCreate() is triggered twice:
1. When a new anonymous account is created.
2. When the anonymous account is linked with email and password.
Which, in my opinion, is fine. However, it would be great if this mechanism worked when linking an anonymous account with Google. Or at least an onUpdate function present. -
Mihey Matev commented
Oddly enough, from what I can tell, if a user created an anonymous account and then links it to their email (whether or not they've linked it to for example Google), the onCreate() trigger gets called a second time (first time being when the anonymous account was created).
However, onCreate() doesn't trigger when linking to Google.Just feels a bit inconsistent.
-
Fernando villarreal commented
Two keep secure
-
David Robertson (Davie) commented
Here's another reason. I have a users/{user} document that's used to store a user's profile.
It's often created when users register via email and password, I then force a linkWithPhoneNumber to verify the user.
but I have enabled:
User account linking
When a user signs in using different identity providers, you can choose to automatically merge accounts on sign in.So I cannot make changes to the document associated with that user, and most of the details of the user need to be updated - and in the case of them doing a Google login then phone and email account are no longer viable auth methods