I'm new to firebase part and I've one requirement to use firebase as a part of serverless architecture, below mentioned is something I need to do, can expertly guide me what to choose from firebase to achieve the same.
I want to create restful API using firebase with NodeJs with an express module of the node, is it something possible or any alternative way to achieve the same using nodejs?
I want to use the firebase authentication mechanism with nodejs code part, ultimately want to create API using the nodeJS with firebase to authenticate the user, so what to use from firebase to achieve the same?
There would be straight forward API that I want to create including the authentication and data store in cloud using firebase, here do I need to use either firestore or real-time database?
I want to deploy the nodeJs project using firebase with firebase cloud, can give me some more details on like how we can do that, reference link sharing would be appreciated.
I had a basic look into few stuff like firebase client SDK, firebase admin SDK, not sure in my case whether I would require to use client SDK or admin SDK to create restFul API.
Note: I want to use no SQL data base, where various collection I can create and can use the same using firebase, I checked that and firestore would perform the same thing, like to store the JSON data, but wanted to know is there any other way to store data or firestore is the best option?
I checked somewhere on reference link about the cloud function, this function can be triggered based on some event, including some https request trigger as well, wanted to confirm using cloud function to create restful API is the good approach or what is the best way to create API using firebase.
I want to create restful API using firebase with NodeJs with express module of node, is it something possible or any alternative way to achieve the same using nodejs?
Yes it is possible
I want to use the firebase authentication mechanism with nodejs code part, ultimately want to create API using the nodeJS with firebase to authenticate the user, so what to use from firebase to achieve the same?
You can use firebase SDK for authentication
There would be straight forward API that I want to create including the authentication and data store in cloud using firebase , here do I need to use either firestore or real time data base?
If you are asking of the database, then you can use any database of your choice, wheater it is MongoDB, firebase-realtime-database etc
Related
I have an admin site that has a react frontend, using redux actions, with a node.js app as the server which uses firebase-admin to do the work.
I want to use firestore's onsnapshot listener. but im not sure how this works within the HTTP protocol?
I can't use the firebase-admin from my frontend app, and i cant create realtime DB functionality from the backend within HTTP protocol.
The goal: to set snapshot listeners on my collections from rreact frontend without having to go through multiple authentication processes, considering ive got a separate auth system for admins with my express api.
Is there a solution for this?
EDIT:
my client app is currently initialized with firebase web app config data, but because im authenticating admins with my own express server, the firebase web SDK hasnt authenticated with firebase, so i dont have permission for the data i need. im not sure if i need a service account, or a web app config with extra setup or what
My recommendation is to integrate the Firebase JS SDK into your client app using signInWithCustomToken().
It's not too complicated to do. Though I suppose that depends a lot on how your current auth setup works.
The general idea is this:
Send auth request to your auth service.
Process the request like normal.
Evaluate if the user should have access to Firebase.
If they should, use firebase-admin to create a custom token and send it back to the user.
Use the token on the client to authenticate with Firebase.auth
You should make sure to have Firestore rules to allow admin users to access the data you need.
As an alternative that doesn't use the Firebase client SDK, you could have a long-running node process that opens an onSnapshot. Your react app could receive data from it using either Server-Sent Events or through a WebSocket
--First time poster, mods please let me know if the question is inappropriate/incorrect--
Situation:
I'm working on an app with friends. We have a dedicated frontend layer and a dedicated nodejs server running MongoDB. I am trying to integrate firebase into our server layer so we can login users and handle minting/verifying/refreshing tokens using Firebase Auth.
Problem:
I'm completely lost as to how to use Firebase Auth for this purpose. I've looked through the docs extensively, I first went down the "Getting Started with Firebase on an App", until I realized (I think) that guide was specifically for web applications without a dedicated backend.
Then I looked more into Firebase Auth Admin, which looked more like what I was looking for. I tried messing with custom token creation and other authentication related matters but I fail to be able to log in.
I reached out to friends for help, they recommended getting local login/googleauth working End-to-end using firebase before trying to secure our tokens moreso than they already are.
I'm very lost and not sure if I'm misunderstanding something fundamental or just not applying the right things. I apologize if this is unclear, I'm just trying to allow email/password login using firebase auth to securely authenticate with my MongoDB data (if that's even necessary)
Any guidance would be appreciated!
You're absolutely right with your approach and its possible to use Firebase Auth for just login/signup and rest of all on mongoDB.
There are 2 ways u can implement the Firebase Auth-
Using the sdk provided by Firebase
Using the Admin Auth API
Which ever way you selected, Later on save your UID on your custom Backend (Which is backed by MongoDB)
Just create your API's to verify user identity.
If you're using NodeJs you can follow this tutorial.
I am trying to use ReactJS and make a firebase app with a user interface but when I try to do the register and login separately I am getting the error of a duplicate app. I want to know how I can import the firebase credentials like the API key and etc, so I can use firebase essentially in different pages like a registration.js or a login.js
I have tried importing but I am not sure how to do that exactly because I am not familiar with firebase on ReactJS
I am trying to use firebase credentials multiple times in my project and in multiple files and I am trying to pull the API key and config credentials more than once and I am wondering on how to do that or how to set up my firebase/app file
thank you
Without cloud functions, it appeared that it required a app server to securely limit signups for a firebase app by email domain according to this old question: How do I lock down Firebase Database to any user from a specific (email) domain?
The goal is to allow only signups from a specific domain or set of domains using google authentication and/or other auth providers.
Now that we have firebase cloud functions how can this be accomplished without an app server?
From the Introduction section of the Firebase Functions page:
Firebase SDK for Cloud Functions integrates the Firebase platform by letting you write code that responds to events and invokes functionality exposed by other Firebase features.
The keyword being responds. The Firebase functions are only meant to react, not prevent, so to speak.
If you picture the scenario of a user signing up, your functions would only fire after a user has been created (functions.auth.user().onCreate). By that measure, if you were to do this with Firebase Functions then you would have to delete the user after it was created, making your client side logic really messy.
The rules that Josep directed you towards is the correct solution. They will actively prevent any signups from a given domain.
I hope this clarifies a bit, even though it might not have been the answer you were looking for. :)
I feel like I am wanting to do something that is either easy, or very wrong. Not sure which one yet.
I am wanting to build an application that is backed by Firebase for:
Authentication
Realtime Database
I will build an Angular2 Front end Single Page App using AngularFire2. Using AngularFire2, the user will authenticate using GoogleAuthentication provider. The Angular2 app will interact with the firebase realtime database directly under most cases.
But I have some cases that I want a NodeJS/Express REST API layer todo more complex business logic and interact with FireBase Database. What I want to have happen is when the user authenticates with AngularFire2 that the accessToken can be used on the API calls to NodeJS in the HTTP Header. Then inside the NodeJS Firebase SDK I just authenticate using that token.
How would you go about doing this? I've been digging through documentation for a while now and still haven't figure it out.
Took lots of digging, but I found the solution. I hope this is a useful thread for others to find.
The accepted answer at: Answer gives a good lead to this. Specifically look at:
Authenticating your privileged workers
Emulating users or limiting access from a server process
Validating client identity via security