小编onr*_*tkn的帖子

Google App Engine Node.js 应用程序中 Firebase 项目的 serviceAccountKey.json 的安全路径

我有一个 Firebase 项目,用户可以与该项目共享一些由媒体和文本组成的内容。为了让 Facebook 正确处理链接,共享内容必须有一个预先填充的页面(在服务器端动态创建,而不是在使用 Firebase JS API 的客户端上)。

因此,我决定使用 Google App Engine (GAE) 将这些内容作为 URL 提供,例如 somedomain.com/?content=hfe84gfjy45xs

var admin = require("firebase-admin");

// Fetch the service account key JSON file contents
var serviceAccount = require("path/to/serviceAccountKey.json");

// Initialize the app with a null auth variable, limiting the server's access
admin.initializeApp({
  credential: admin.credential.cert(serviceAccount),
  databaseURL: "https://databaseName.firebaseio.com",
  databaseAuthVariableOverride: null
});
Run Code Online (Sandbox Code Playgroud)

path/to/serviceAccountKey.json文件放在项目文件夹中是否安全?我是否必须将文件放入 Google Cloud Storage 实例?

提前致谢。

security google-app-engine facebook node.js firebase

2
推荐指数
1
解决办法
2238
查看次数