问题
In order to set a custom claim, one uses:
admin.auth().setCustomUserClaims(uid,{claim:value});
There does exist
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.
回答1:
From the documentation:
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});
回答2:
I don't think you can use updateUser for this, I think you still need to call
admin.auth().setCustomUserClaims(uid, {claim:null});
来源:https://stackoverflow.com/questions/48175477/in-firebase-authentication-is-there-a-way-to-remove-a-custom-claim