This is the runnable sample code from the blog post [Patterns for security with Firebase Authentication: offload work to Cloud Functions][1]. It discusses offloading work from a client app to Cloud Functions using an authentication trigger.
- Create a new Firebase project
- Enable email/password authentication
- Provision Cloud Firestore and apply the rules given in this gist
- Use the Firebase CLI to create a workspace for Functions using TypeScript
- Deploy the given HTML and JavaScript to Firebase Hosting (the CLI emulator will also work).
- Deploy the function code to Cloud Functions using the Firebase CLI