使用Firebase凭证访问Google云存储 [英] access google cloud storage with firebase credential

查看:70
本文介绍了使用Firebase凭证访问Google云存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用firebase身份验证的node.js客户端.现在,我想访问Google Cloud Storage,但是用于node.js的firebase SDK不包括GCS.使用@ google-cloud/storage可以使用,但只能使用匿名访问.如何将Firebase凭据应用于@ google-cloud/storage,以使GCS访问处于已登录用户的上下文中?

I have a node.js client that uses firebase authentication. Now I want to access Google Cloud Storage, however the firebase SDK for node.js does not include GCS. Using @google-cloud/storage works but only with anonymous access. 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的Node.js客户端SDK.由于Firebase Admin SDK和用于Node.js的Google Cloud Platform客户端都使用管理特权来访问Cloud Storage,因此,对于您来说,这些特权也不是一种选择.

There is no Node.js client SDK for Firebase that accesses 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.

我能想到的两个选择是:

The two options I can think of are:

  • 在Cloud Function中使用Admin SDK,并以这种方式公开来自Cloud Storage的文件.
  • 使用REST API进行云存储.

我承认两者都不是小事,所以我希望有人知道更好的解决方案.

I admit that neither is trivial, so I hope somebody knows a better solution.

这篇关于使用Firebase凭证访问Google云存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆