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

Firebase Admin NodeJS SDK: TenantAwareAuth.createSessionCookie() throws unsupported tenant operation

使用 Firebase Admin SDK 实现租户感知身份验证实例时,我无法使用 following method

代码:

    // 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)
    }
  }

错误:

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'

版本:

补充:

这已作为功能请求提交。您可以通过提交的feature request link.

查看其状态

您可能需要检查此 Stack Overflow link 作为解决方法。