gpt4 book ai didi

javascript - 传入的 JSON 对象不包含 client_email 字段

转载 作者:行者123 更新时间:2023-12-03 03:10:43 24 4
gpt4 key购买 nike

我正在尝试创建一个 Firebase 云函数。所以我想在本地运行我的 firebase 云函数。但如何设置身份验证不起作用。

我已经安装了 firebase 工具:https://firebase.google.com/docs/functions/local-emulator我已经运行了命令 firebase login,所以现在我已经登录了。然后我用本教程创建了我的 json key :https://cloud.google.com/docs/authentication/getting-started现在,如果我输入 echo $GOOGLE_APPLICATION_CREDENTIALS ,结果是 /home/$USER/.google/****.json 其中包含

"project_id","private_key_id","private_key","client_email", "client_id",  "auth_uri", "token_uri", "auth_provider_x509_cert_url", "client_x509_cert_url"

此外,我还尝试安装完整的 google cloud sdk 并运行:gcloud auth application-default login 但没有成功。

Npm 软件包版本:

"firebase-functions":"3.0.2"
"firebase-admin": "8.2.0"

我认为我已经提供了足够的信息,但如果您愿意,请随时向我询问更多信息。

const functions = require("firebase-functions");
const admin = require("firebase-admin");
const express = require("express");
const app = express();
app.get("/", async (req, res) => {
admin.firestore().collection('something').get().then((collection) =>
return res.send({"count": collection.docs.length, "status": 200});
});
exports.exports = functions.https.onRequest(app);

代码并不重要,最重要的是,即使我已经完成了所有这些步骤,当我使用 firebaseserve 在本地模拟我的 firebase 并触发一个函数时,我遇到了这个错误:错误:传入的 JSON 对象不包含 client_email 字段

我可以确保 json 文件包含 client_email 字段。

你能帮我通过 Google 进行身份验证吗?

感谢您的帮助。

最佳答案

我也遇到了类似的问题。这可能是 firebase-tools 版本 7.0.2 中的错误。我回滚到版本 7.0.0,现在可以使用了。

所以临时解决办法是:

npm i firebase-tools@7.0.0 -g  

关于javascript - 传入的 JSON 对象不包含 client_email 字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56789424/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com