当使用Firebase实现租户感知的auth实例时,我不能使用跟随法。
代码:
// 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'版本:
附加信息:
getAuth())https://stackoverflow.com/questions/69831956
复制相似问题