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?
2 Answers
0
votes
0
votes
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:
- Use the Admin SDK in a Cloud Function, and expose the files from Cloud Storage that way.
- Use the REST API for Cloud Storage.
I admit that neither is trivial, so I hope somebody knows a better solution.
firebase.auth().signInWithPopup(provider).then(function(result) {token = result.credential.accessToken;- John Hanley