英文:
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示例
这里有一个可能的解决方法:
使用特定方法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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论