A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://firebase.google.com/docs/functions/auth-events below:

Firebase Authentication triggers | Cloud Functions for Firebase

Firebase Authentication triggers

Stay organized with collections Save and categorize content based on your preferences.

You can trigger functions in response to the creation and deletion of Firebase user accounts. For example, you could send a welcome email to a user who has just created an account in your app. Examples on this page are based on a sample that does exactly this—sends welcome and farewell emails upon account creation and deletion.

For more examples of use cases, see What can I do with Cloud Functions?.

Note: Cloud Functions for Firebase (2nd gen) does not provide support for the events and triggers described in this guide. Because 1st gen and 2nd gen functions can coexist side-by-side in the same source file, you can still develop and deploy this functionality together with 2nd gen functions. Trigger a function on user creation

You can create a function that triggers when a Firebase user is created using the functions.auth.user().onCreate() event handler:

exports.sendWelcomeEmail = functions.auth.user().onCreate((user) => {
  // ...
});

Firebase accounts will trigger user creation events for Cloud Functions when:

A Cloud Functions event is not triggered when a user signs in for the first time using a custom token.

Access user attributes

From the user data returned to your function, you can access the list of user attributes available in the newly created user's UserRecord object. For example, you can get the user's email and display name as shown:

const email = user.email; // The email of the user.
const displayName = user.displayName; // The display name of the user.
Trigger a function on user deletion

Just as you can trigger a function on user creation, you can respond to user deletion events. Use the functions.auth.user().onDelete() event handler as shown:

exports.sendByeEmail = functions.auth.user().onDelete((user) => {
  // ...
});
Caution: Deleting multiple users at once using the Firebase Admin SDK (for example, admin.auth().deleteUsers([uid1, uid2]) in Node.js) does not fire user deletion events, so event handlers set up using functions.auth.user().onDelete() will not be triggered. Delete users one at a time if you want user deletion events to fire for each deleted user. Trigger blocking functions

If you've upgraded to Firebase Authentication with Identity Platform, you can extend Firebase Authentication using blocking Cloud Functions.

Blocking functions let you execute custom code that modifies the result of a user registering or signing in to your app. For example, you can prevent a user from authenticating if they don't meet certain criteria, or update a user's information before returning it to your client app.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-15 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-15 UTC."],[],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4