简体   繁体   English

无法将管理员 SDK 连接到 firebase 身份验证模拟器

[英]Cannot connect Admin SDK to firebase authentication emulator

I am trying to connect the Admin SDK to the firebase authentication emulator.我正在尝试将管理员 SDK 连接到 firebase 身份验证模拟器。 But for some reason, the Admin SDK keeps connecting to the live online project.但由于某种原因,管理员 SDK 一直连接到实时在线项目。 The firebase authentication emulator is running though. firebase 身份验证仿真器正在运行。 I tried setting setting the FIREBASE_AUTH_EMULATOR_HOST environment variable GOOGLE_APPLICATION_CREDENTIALS = key.json and the project ID by admin.initializeApp({ projectId: "YOUR_PROJECT_ID" }; . It didn't work. I tried downloading the key from Google Cloud Console using a service account and setting the GOOGLE_APPLICATION_CREDENTIALS environment variable to point to that key . But the admin SDK still uses the live project. How do I connect the admin SDK to the local firebase authentication emulator?我尝试设置 FIREBASE_AUTH_EMULATOR_HOST 环境变量GOOGLE_APPLICATION_CREDENTIALS = key.jsonadmin.initializeApp({ projectId: "YOUR_PROJECT_ID" };的项目 ID。它没有用。我尝试使用服务帐户从 Google Cloud Console 下载密钥并将 GOOGLE_APPLICATION_CREDENTIALS 环境变量设置为指向该密钥。但是管理员 SDK 仍然使用实时项目。如何将管理员 SDK 连接到本地 ZBF12E15515C25C7DFAemulator?

You can connect the admin SDK by setting an environment variable.您可以通过设置环境变量来连接管理员 SDK。

eg: Using the command line:例如:使用命令行:

export FIREBASE_AUTH_EMULATOR_HOST='localhost:9099'

Using node, you can also set this with:使用节点,您还可以通过以下方式进行设置:

process.env.FIREBASE_AUTH_EMULATOR_HOST='localhost:9099'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM