Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何为Firebase中的每个用户创建配置文件_Firebase_Firebase Realtime Database - Fatal编程技术网

如何为Firebase中的每个用户创建配置文件

如何为Firebase中的每个用户创建配置文件,firebase,firebase-realtime-database,Firebase,Firebase Realtime Database,我正在与firebase合作,我有一个问题,我需要在新用户首次登录时将其添加到我的配置文件表中 我找不到使用社交媒体登录和使用电子邮件登录的方法,我要做的是在用户处于注册表窗体时,使用uid将新注册表推送到表中。您可以使用 使用: 谢谢你在这方面给了我很多帮助。 exports.saveUserInDatabase = functions.auth.user().onCreate(event => { const user = event.data; // The Firebase

我正在与firebase合作,我有一个问题,我需要在新用户首次登录时将其添加到我的配置文件表中

我找不到使用社交媒体登录和使用电子邮件登录的方法,我要做的是在用户处于注册表窗体时,使用uid将新注册表推送到表中。

您可以使用

使用:


谢谢你在这方面给了我很多帮助。
exports.saveUserInDatabase = functions.auth.user().onCreate(event => {
    const user = event.data; // The Firebase user

    const id = user.uid; // The id of the user
    const email = user.email; // The email of the user
    const displayName = user.displayName; // The display name of the user

    // Add user in the database
    return admin.database().ref('/users').child(id).child('userData').set('userValue');
});