在Firebase身份验证中,是否可以删除自定义声明? [英] In firebase authentication, is there a way to remove a custom claim?

查看:72
本文介绍了在Firebase身份验证中,是否可以删除自定义声明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了设置自定义声明,可以使用:

In order to set a custom claim, one uses:

admin.auth().setCustomUserClaims(uid,{claim:value});

确实存在

admin.auth().updateUser(uid,{claim:value});

...但是我不清楚两者之间的区别,而且似乎都没有人真正删除以前应用的自定义声明.

...but I'm not exactly clear on how the two are different, and neither one seems to get at actually removing a previously applied custom claim.

推荐答案

来自文档:

您可以通过为customClaims传递null来删除用户的自定义声明.

You can delete a user's custom claims by passing null for customClaims.

因此,这应删除该声明:

So this should delete the claim:

admin.auth().updateUser(uid, {claim: null});

这篇关于在Firebase身份验证中,是否可以删除自定义声明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆