Search code examples
firebase-authenticationfirebase-admin

Firebase how to send password sign in link to many users from cloud function


I have 1000 or so users that I will be importing from a csv. I then want to run a process to email the users a link so they can log in without a password.

I was going to use auth.sendSignInLinkToEmail() to send from a firebase cloud function, but I see this is not available in the admin SDK.

Ideally I don't want to add a button to my existing app just for these users to use passwordless sign in as this would be a one time thing.

I'm looking for a simple way to do this, any suggestions?


Solution

  • Firebase by design doesn't offer an API to accomplish your use-case or other use-cases that send messages to many users, as it'd be an abuse vector and make it even more likely that the emails would be marked as spam. Also see: Error: auth.sendSignInLinkToEmail is not a function

    Instead of using Firebase to send bulk emails, send them a separate email from a provider of your choice and them let them trigger the actual auth email from the device.

    Or you can implement your own custom auth provider, and implement the exact flow you want.