Do I have to enable Firebase if I want to connect to my Cloud Firestore database from outside of Google cloud products? - firebase

Till now I was using service account to connect to my Firestore database (Firebase is not enabled) from within Google products like Cloud Functions or Colab.
Now I need to connect to Firestore from html page opened in my browser. Is it possible without enabling Firebase?

Yes, the Google Cloud Firestore NodeJS SDK is meant to be used on server side only. You can use Firebase Web SDK along with Firebase Authentication and Firebase Security Rules to support serverless app architectures where clients connect directly to your Firestore database.
You don't necessarily have to use Firebase Auth. However, it might be a good idea to restrict access and allow only public content to be accessible without authentication.
You can follow the quickstart in the documentation to setup the client SDK.

Related

Firebase Remote Config/Realtime database on Huawei devices

Are all of the Firebase services for Android unable to work on Huawei or is it just the cloud messaging service that does not work? Do all of the firebase services rely on Google Play Services?
Firebase SDKs can be divided into three categories:
Play services required — These SDKs require Google Play services, otherwise they have no functionality.
Play services recommended — These SDKs require Google Play services to have full functionality, but they still offer most functionality even without Google Play services.
Play services not required — These SDKS do not require Google Play services to have full functionality.
List of Firebase SDKs that don't require Google Play services
List of Firebase SDKs that you need to include Google Play services
Remote Config SDK com.google.firebase:firebase-config:20.0.0 doesn't require Google Play Services.
Realtime Database SDK com.google.firebase:firebase-database:19.5.1 doesn't require Google Play Services.
But keep in mind that Realtime Database depends on Firebase Auth (it needs an authenticated user to work) which depends on Google Play Services. For that you can use Firebase Auth REST API instead of Firebase Auth SDK.
For more info Use Firebase Authentication without Google Play services
Update 27 Oct 2020:
Firebase Auth SDK v20.0.0 com.google.firebase:firebase-auth:20.0.0 doesn't require Google Play Service.
Official Dependencies of Firebase Android SDKs on Google Play services
The following Firebase products depend on Firebase Authentication.
Firebase Realtime Database
Cloud Firestore
Cloud Functions
Cloud Storage
You just need to replace Firebase Authentication with Firebase Auth REST SDK. Using this SDK, you don't need to change your existing Firebase Realtime Database code. It will start working on Huawei devices and also GMS devices as well.
Docs: Firebase Auth REST SDK - How to use Firebase Authentication on HMS phones
Firebase official stance is that all Firebase services require Google Play Services to work. Yes, some Firebase services actually work without GPS currently, however this can change at any time without prior notice.
Firebase services will not work on the new Huawei Phones.
For Huawei devices you can take a look to HMS and App Gallery Connect Services
Remote config: https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-remoteconfig-introduction
Cloud DB: https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/clouddb-apply
Push Notifications: https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/push-introduction
To make your app compatible with all devices, you can use the G+H solution:
https://forums.developer.huawei.com/forumPortal/en/topicview?tid=0201200435859940059&fid=0101187876626530001

User role for Firestore manage in Google cloud

I can't figure it out which role/s do I need to have on one of my client's Google Cloud Platform, to do the following:
- Connect and Manage a Firestore database to their Firebase app.
- Use the Google Cloud Firestore API from an external app.
There are so many roles... Any help? :)
I have already Firebase Analytics Admin but when I tried to access the Firestore through Firebase I get the message "To manage Cloud Firestore, ask a project owner for the necessary permissions".
Thanks!
According to the Firebase product-category predefined roles documentation, the only role that has full read/write access to Cloud Firestore is:
Firebase Develop Admin - roles/firebase.developAdmin
Regarding the access to the API, the app will be able to access it using either a Firebase Authentication ID token or a Google Identity OAuth 2.0 token as per referenced on this documentation.
In order to set up Firebase Auth, this link might be of help and for OAuth check this link.

Connect to Firebase buckets

I have a backend in golang and was wondering how I can connect to Firebase storage to create/delete buckets and add/delete files. Can I use the Admin sdk. I found the client storage lib in golang for google cloud storage. Can I use that? And whats the difference between firebase storage and google cloud storage?
The app I'm working on connects to Firebase Storage Buckets via the Admin SDK, but we're using Firebase Functions in Node.js. However, it looks like the Admin SDK in Go offers the same Storage access, and it's documented (with example code in Go) here:
https://firebase.google.com/docs/storage/admin/start
I like using Admin in Firebase, because you don't have to worry about project configuration and authentication to the various services. Firebase storage is google cloud storage, but with a nice wrapper and well-integrated into other aspects of your Firebase project. You get some limitations as a trade-off for all of that convenience, but unless you run into a feature of Google Cloud that you absolutely need and doesn't exist in Firebase, I'd stick with the Firebase (and Admin) version.

access google cloud storage with firebase credential

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?
Node.js is a server that operates in a privileged environment. The Firebase Admin SDK (aka the Node SDK) talks to other services via a service account.
Firebase Authentication enables client-side authentication. The JavaScript SDK is the client-side SDK.
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.

Difference between Firebase Admin SDK and Firebase Admin Web API

I want to take a decision to use Firebase Admin SDK or Firebase Admin REST API.
I need to use it in the communication from Angular/Node.js to Firebase database.
Please let me know if you can share the comparison between this two.
Thanks.
For communicating from an Angular web app with the Firebase Database, use the Firebase Web SDK.
For communicating from a server-side Node.js process with the Firebase Database, use the Firebase Admin SDK.
For communicating with the Firebase Database from a platform for which there is no SDK, use the Firebase REST API.

Resources