简体   繁体   English

使用Firebase凭证访问Google云存储

[英]access google cloud storage with firebase credential

I have a node.js client that uses firebase authentication. 我有一个使用firebase身份验证的node.js客户端。 Now I want to access Google Cloud Storage, however the firebase SDK for node.js does not include GCS. 现在,我想访问Google Cloud Storage,但是用于node.js的firebase SDK不包括GCS。 Using @google-cloud/storage works but only with anonymous access. 使用@ google-cloud / storage可以,但是只能使用匿名访问。 How do I apply the firebase credential to @google-cloud/storage so that GCS access is in the context of the logged-in user? 如何将Firebase凭据应用于@ google-cloud / storage,以使GCS访问处于已登录用户的上下文中?

Node.js is a server that operates in a privileged environment. Node.js是在特权环境中运行的服务器。 The Firebase Admin SDK (aka the Node SDK) talks to other services via a service account. Firebase Admin SDK(又名Node SDK)通过服务帐户与其他服务对话。

Firebase Authentication enables client-side authentication. Firebase身份验证启用客户​​端身份验证。 The JavaScript SDK is the client-side SDK. JavaScript SDK是客户端SDK。

There is no Node.js client SDK for Firebase that accesses Cloud Storage. 没有用于Firebase的Node.js客户端SDK,可以访问Cloud Storage。 Since both the Firebase Admin SDK and the Google Cloud Platform client for Node.js use administrative privileges to access Cloud Storage, it looks like those won't be an option for you either. 由于Firebase Admin SDK和Node.js的Google Cloud Platform客户端都使用管理特权来访问Cloud Storage,因此看起来这些都不是您的选择。

The two options I can think of are: 我能想到的两个选择是:

  • Use the Admin SDK in a Cloud Function, and expose the files from Cloud Storage that way. 在Cloud Function中使用Admin SDK,然后以这种方式公开Cloud Storage中的文件。
  • Use the REST API for Cloud Storage. 将REST API用于云存储。

I admit that neither is trivial, so I hope somebody knows a better solution. 我承认两者都不是小事,所以我希望有人知道更好的解决方案。

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

相关问题 如何从服务器上的 Firebase 函数访问 Google Cloud Storage - How to access Google Cloud Storage from Firebase functions on the server Firebase 云消息传递:app/invalid-credential - 无法获取有效的 Google OAuth2 访问令牌 - Firebase Cloud messaging : app/invalid-credential - failed to fetch a valid Google OAuth2 access token 如何通过 Firebase 管理员访问 Google Cloud Storage 中的存储桶 - how to access bucket in Google Cloud Storage via Firebase admin Firebase和Google Cloud Storage API - Firebase and Google Cloud Storage API 如何使用 Firebase 从移动设备访问尝试访问 Google Cloud 中的存储位置的日志? - How can you access the log of attempts to access a storage location in Google Cloud done from a mobile device with Firebase? 向我的 Firebase 用户授予对 Cloud Storage 的访问权限 - Grant access to Cloud Storage to my Firebase users Firebase / Google Cloud Storage文件安全性 - Firebase/Google Cloud Storage file security Firebase数据库和谷歌云存储不同步 - Firebase database and google cloud storage out of sync 从 Google Cloud 上传到 Firebase 存储 Function - Uploading to Firebase Storage from a Google Cloud Function firebase 云存储限制读取访问令牌 - firebase cloud storage restrict read of access token
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM