Firebase Admin SDK 不连接到身份验证模拟器

The Firebase Admin SDK Don't Connect to The Authentication emulator

管理员身份验证连接到 firebase 项目身份验证,而不是模拟器身份验证

当我使用 this code 列出用户时,结果是 firebase 部署项目中的用户,而不是模拟器中的用户

我尝试了 this method 结果是一样的,当我尝试更改为

中的项目 ID 时
admin.initializeApp({
projectId: "your-project-id"
});

这是显示的错误

errorInfo: { code: 'auth/insufficient-permission', message: 'Credential implementation provided to initializeApp() via the "credential" property has insufficient permission to access the requested resource. See https://firebase.google.com/docs/adoogle.com/docs/admin/setup for details on how to authenticate this SDK with appropriate permissions.' },

这个警告是在终端

The Firebase Authentication emulator is running, but your 'firebase-admin' dependency is below version 9.3.0, so calls to Firebase Authentication will affect production.

所以通过将 firebase-admin 更新到 9.8.0 它起作用了