firebase / firebase/firebase-admin-node
[firebase_auth] token issued by createCustomToken are not valid with emulated in <<demo>> project
- 主要语言
- TypeScript
- 星标
- 1.7k
- 派生
- 419
- 平均合并
- 3 天 10 小时
- 30 天内合并 PR
- 16
描述
As per the documentation:
<< For security reasons, the Authentication emulator issues unsigned ID tokens, which are only accepted by other Firebase emulators, or the Firebase Admin SDK when [configured](https://firebase.google.com/docs/emulator-suite/connect_auth#admin_sdks). >>
So when there is an env variable `FIREBASE_AUTH_EMULATOR_HOST="127.0.0.1:9099"` firebase admin is supposed to give unsigned tokens via the emulator, which it does not:
The following:
```ts
const user = await admin.auth().createUser({ uid: randomUUID() });
const jwt = await admin.auth().createCustomToken(user.uid);
```
Results in:
```
Firebase ID token has incorrect "aud" (audience) claim. Expected "demo-test" but got "https://identitytoolkit.googleapis.com/google.identity.identitytoolkit.v1.IdentityToolkit"
```
贡献指南
调研方向
首先,在将 FIREBASE_AUTH_EMULATOR_HOST 设置为 127.0.0.1:9099 的情况下复现 TypeScript 示例,然后跟踪 createCustomToken 路径及其模拟器配置。当为 demo-test 项目创建的自定义令牌被 Authentication 模拟器以预期的 audience 和无签名令牌行为接受时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- firebase, nodejs, typescript
- 领域
- authentication
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100