有没有用于身份验证用户删除的Python函数?

huangapple go评论77阅读模式
英文:

Is there a python function for authentication user delete?

问题

我试图将我的JavaScript Firebase函数迁移到Python,代码如下:

def delete_user_doc(event):
    # function body

然而,在查阅了大量Python文档后,我没有找到对应的事件监听器。我是遗漏了什么,还是目前还不支持?

英文:

I'm trying to migrate my JavaScript Firebase function over to Python, which looks like this:

exports.deleteUserDoc = functions.auth.user().onDelete(user => {
    // function body
});

However, after lots of looking around through the Python docs, I couldn't find an equivalent event listener. Am I missing something, or is it not supported yet?

答案1

得分: 0

目前,关于您提到的onDelete()事件监听器,Python没有直接等效的功能。

在查找参考资料时,我已经在firebase/functions-samples中进行了检查,这是查看它的链接:github

您还可以查看Python示例

这里有一个可能的解决方法:

您可以使用firebase_admin.auth模块

使用特定方法get_user_by_email来搜索要删除的用户的UID,然后调用方法delete_user来删除它。

您还可以查看这个链接删除用户

希望对您有所帮助。

英文:

Currently there is no Python direct equivalent when it comes to the onDelete() event listener you mentioned.

Upon searching for references I have check it under the firebase/functions-samples here is the link to check it: github

You can also check the Python samples

There is a possible workaround:

You can use the firebase_admin.auth module

Use the specific method get_user_by_email to search the UID of the user you wanted to delete it and then call the method delete_user to delete it.

You can also check this out Delete a user

Hope it helps.

huangapple
  • 本文由 发表于 2023年6月13日 03:12:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/76459664.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定