firebase / firebase/firebase-admin-node

[FR]: add function to set single claim instead of all claims `setCustomUserClaim('myClaim', value)`

未关闭
#2,742 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
api: auth type: feature request
主要语言
TypeScript
星标
1.7k
派生
419
平均合并
3 天 10 小时
30 天内合并 PR
16

描述

**Is your feature request related to a problem? Please describe.**
When updating auth custom claims, i need to make sure i always include all existing claims, because `setCustomUserClaims` always overrides all claims. --> When multiple requests run simultaneously, we run into transactional issues (2 requests read claims, first requests updates claims with a new field, second request updates claims with another field but overrides changes from first request).

**Describe the solution you'd like**
`setCustomUserClaim('myClaim', value)` in addition to `setCustomUserClaims(allClaims)`

**Describe alternatives you've considered**
Writing claims to my own db, then regularly sync it to firebase -> this is too complicated though for something that could be solved much simpler with a new method `setCustomUserClaim`.

**Additional context**
none

贡献指南

打开贡献指南

调研方向

首先阅读现有的 setCustomUserClaims API 以及 Authentication SDK 中对 custom claims 的处理。定义 setCustomUserClaim 方法的并发和替换语义,然后添加更新单个 claim 而不覆盖其他 claims 的测试覆盖;当 API 及其行为都有文档说明并经过测试时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
nodejs, typescript
领域
authentication, backend-api-design
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。