How to secure Firebase account etc. from user actions?

梦想的初衷 提交于 2019-12-08 15:22:29

With Cloud functions for firebase you could for example trigger a function on user deletion. That way every time a user is deleted, you can run your code to do the clean up. No matter how the user deletion is invoked.

exports.removeUserFromDatabase = functions.auth.user().onDelete(function(event) {
    // Get the uid of the deleted user.
    var uid = event.data.uid;

    // Remove the user from your Realtime Database's /users node.
    return admin.database().ref("/users/" + uid).remove();
});

The same goes for "onCreate". Check out their documentation https://firebase.google.com/docs/auth/extend-with-functions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!