Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

FirbaseAdmin.Auth().verifyIdToken not tenant aware

未关闭
#2,803 1 条评论 1 个 reaction 已指派 1 人 在 GitHub 查看

@Xiaoshouzi-gh 已经在做这个了。

开始于 2024年12月19日。

评估

这个 Issue 还没有评估数据。

描述

api: auth
  • Operating System version: run.googleapis.com (linux)
  • Firebase SDK version: 5.1.0
  • Firebase Product: Admin auth
  • Node.js version: 20
  • NPM version: 10.8.2
Verify id tokens in firebase functions will fail when using tenants in Google Identity platform
Steps to reproduce:

1 Create a app in Firebase and enable google identitiy platform.
2 Add tenant to identities platform
3 Add user to tenant
4 Log into app using user and tenant id
5 call google function from app
6 in function attempt to verify id token with FirebaseAdmin.auth().verifyIdToken('tokenString')

error
Error: There is no user record corresponding to the provided identifier.

Relevant Code:
  var token = await admin.auth() .verifyIdToken(req.rawRequest.header('Authorization').substring(7),true);

I could use the TenantAuth but to get that I would need the TennantId which is in the token, which you can access by verifying the token but like I said you need to know the tenant for that. I could manually scrape the tenantId from the jet by parsing it myself but then I have to hard code its location in the jwt firebase attribute with could change.

    var tenantAuth = await admin.auth().tenantManager().authForTenant(token.firebase.tenant);
    var token = await tenantAuth.verifyIdToken(req.rawRequest.header('Authorization').substring(7),true);

Expected functionality would be that it detect the presence of a tenant in the firebase attribute and attempt to get the correct tenantAuth instance and use that to verify.

主要语言
TypeScript
星标
1.7k
派生
419
平均合并
4 天 20 小时
30 天内合并 PR
16

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

firebase/firebase-admin-node 的其他 Issue

查看 firebase/firebase-admin-node 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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