How to query firebase from a node backend with the credentials of the client

340
June 23, 2017, at 1:57 PM

Here is a starter example

https://github.com/zeit/next.js/tree/master/examples/with-firebase

Unfortunately the firebase-admin tool and credentials is like accessing firebase with a root user. I originally thought some magic would happen with the req.session.decodedToken, but it appears that this is solely for passing the user object as props.

The objective here is to have a server rendered page as it would be in the front end.

The firebase npm package states that it can be used in the backend:

https://www.npmjs.com/package/firebase

In the client the firebase package seems to be using data from local storage. After successfully authenticating I can see a entry in local storage firebase:authUser:TOKEN. I assume all firebase queries use the data in that key.

But how do you do this in the backend? Since this seems to happen automatically, I'm not sure how to tell firebase to use data from session for authentication.

Rent Charter Buses Company
READ ALSO
NodeJS pass value between asynchronous functions

NodeJS pass value between asynchronous functions

The most simplified version of what I need to do is the following:

330
(node.js) Cannot read property 'hashtag' of undefined. I guess this is bug

(node.js) Cannot read property 'hashtag' of undefined. I guess this is bug

I've faced terrible error recentlyI couldn't fix it still

300
How to count the total number of items in multi-dimensional array?

How to count the total number of items in multi-dimensional array?

Below is my code I am using to retrieve the data from my repeater tableThis gives the output in multi dimensional array

402
How to run os specific command in package.json file?

How to run os specific command in package.json file?

I have a nodejs application and need to be run in both linux and windowsI need to detect the os type then choose the correspond command

394