首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Firebase Admin NodeJS SDK: TenantAwareAuth.createSessionCookie()抛出不支持的租户操作

Firebase Admin NodeJS SDK: TenantAwareAuth.createSessionCookie()抛出不支持的租户操作
EN

Stack Overflow用户
提问于 2021-11-03 21:29:20
回答 1查看 257关注 0票数 0

当使用Firebase实现租户感知的auth实例时,我不能使用跟随法

代码:

代码语言:javascript
复制
    // defined elsewhere: locals.tenantAuth = getAuth().tenantManager().authForTenant(tenantId)

    async createSession (locals) {
    try {
      const { idToken, expiresIn, tenantAuth } = locals
      const decodedToken = await tenantAuth.verifyIdToken(idToken, true) // this works
      // Only process if the user just signed in in the last 3 minutes
      if (new Date().getTime() / 1000 - decodedToken.auth_time < 3 * 60) {
        return await tenantAuth.createSessionCookie(idToken, { expiresIn }) // this breaks
      } else {
        throw new Error('Cannot create session, sign in information is too old')
      }
    } catch (error) {
      console.log(error)
      throw new Error(error)
    }
  }

错误:

代码语言:javascript
复制
FirebaseAuthError: This operation is not supported in a multi-tenant context.
errorInfo: {
  code: 'auth/unsupported-tenant-operation',
  message: 'This operation is not supported in a multi-tenant context.'
},
codePrefix: 'auth'

版本:

  • Nodejs: 16.13.0
  • Firebase Admin SDK: 10.0.0

附加信息:

  • 方法在tenantAware auth之外工作(使用默认项目getAuth())
  • v9上的相同错误
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-11-04 08:28:12

这已经作为特性请求提交了。您可以通过此提交的特征请求链接检查其状态。

您可能需要检查此堆栈溢出链路作为解决方法。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69831956

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档