تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
يمكنك تشغيل الدوال استجابةً لعمليات إنشاء حسابات المستخدمين وحذفها.Firebase على سبيل المثال، يمكنك إرسال رسالة ترحيب إلكترونية إلى مستخدم أنشأ حسابًا في تطبيقك. تستند الأمثلة الواردة في هذه الصفحة إلى نموذج يفعل ذلك بالضبط، أي يرسل رسائل ترحيب ووداع إلكترونية عند إنشاء الحساب وحذفه.
ستؤدي حسابات Firebase إلى تشغيل أحداث إنشاء المستخدمين
Cloud Functions في الحالات التالية:
ينشئ المستخدم حساب بريد إلكتروني وكلمة مرور.
يسجّل المستخدم الدخول لأول مرة باستخدام موفّر هوية موحّدة.
ينشئ المطوّر حسابًا باستخدام Admin SDK.
يسجِّل المستخدم الدخول إلى جلسة مصادقة مجهولة جديدة للمرة الأولى.
Cloud Functions لا يتم تشغيل الحدث عندما يسجّل المستخدم الدخول للمرة الأولى باستخدام رمز مميّز مخصّص.
الوصول إلى سمات المستخدم
من بيانات المستخدم التي تم إرجاعها إلى الدالة، يمكنك الوصول إلى قائمة سمات المستخدم المتوفّرة في عنصر UserRecord الخاص بالمستخدم الذي تم إنشاؤه حديثًا. على سبيل المثال، يمكنك الحصول على البريد الإلكتروني للمستخدم واسم العرض كما هو موضّح:
إذا تمت الترقية إلى Firebase Authentication with Identity Platform، يمكنك تمديد Firebase Authentication باستخدام
حظر Cloud Functions.
تتيح لك دوال الحظر تنفيذ رمز مخصّص يعدّل نتيجة تسجيل المستخدم أو تسجيل الدخول إلى تطبيقك. على سبيل المثال، يمكنك منع مستخدم من إثبات الهوية إذا لم يستوفِ معايير معيّنة، أو تعديل معلومات المستخدم قبل إرسالها إلى تطبيق العميل.
تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["\u003cbr /\u003e\n\nYou can trigger functions in response to the creation and deletion of\nFirebase user accounts. For example, you could send a welcome email to a\nuser who has just created an account in your app. Examples on this page are\nbased on a sample that does exactly this---sends welcome and farewell emails\nupon account creation and deletion.\n\nFor more examples of use cases, see\n[What can I do with Cloud Functions?](/docs/functions/use-cases).\n| **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.\n\nTrigger a function on user creation\n\nYou can create a function that triggers when a Firebase user is\ncreated using the\n[`functions.auth.user().onCreate()`](/docs/reference/functions/firebase-functions.auth.userbuilder#authuserbuilderoncreate)\nevent handler:\n\n\u003cbr /\u003e\n\n```gdscript\nexports.sendWelcomeEmail = functions.auth.user().onCreate((user) =\u003e {\n // ...\n});\n```\n\n\u003cbr /\u003e\n\nFirebase accounts will trigger user creation events for\nCloud Functions when:\n\n- A user creates an email account and password.\n- A user signs in for the first time using a federated identity provider.\n- The developer creates an account using the Admin SDK.\n- A user signs in to a new anonymous auth session for the first time.\n\nA Cloud Functions event is *not* triggered when a user signs in for the\nfirst time using a custom token.\n\nAccess user attributes\n\nFrom the user data returned to your function, you can\naccess the list of user attributes available in the newly created user's\n[`UserRecord`](/docs/reference/functions/firebase-functions.auth#authuserrecord)\nobject. For example, you can get the user's email and display name as shown:\n\n\u003cbr /\u003e\n\n```gdscript\nconst email = user.email; // The email of the user.\nconst displayName = user.displayName; // The display name of the user.https://github.com/firebase/functions-samples/blob/c4fde45b65fab584715e786ce3264a6932d996ec/Node-1st-gen/quickstarts/email-users/functions/index.js#L48-L49\n```\n\n\u003cbr /\u003e\n\nTrigger a function on user deletion\n\nJust as you can trigger a function on user creation, you can\nrespond to user deletion events. Use the\n[`functions.auth.user().onDelete()`](/docs/reference/functions/firebase-functions.auth.userbuilder#authuserbuilderondelete)\nevent handler as shown:\n\n\u003cbr /\u003e\n\n```gdscript\nexports.sendByeEmail = functions.auth.user().onDelete((user) =\u003e {\n // ...\n});\n```\n\n\u003cbr /\u003e\n\n| **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.\n\nTrigger blocking functions\n\nIf you've upgraded to Firebase Authentication with Identity Platform, you can extend Firebase Authentication using\n[blocking Cloud Functions](/docs/auth/extend-with-blocking-functions).\n\nBlocking functions let you execute custom code that modifies the result of a\nuser registering or signing in to your app. For example, you can prevent a user\nfrom authenticating if they don't meet certain criteria, or update a user's\ninformation before returning it to your client app."]]