My question is very similar to the one found here however that question never seem to get fully answered.
I have a set of HTTPS Post calls within cloud functions that write to my firebase realtime database.
For example:
app.post('/api/dosomething', (req, res) => {
//implementation...
});
The problem is when I write to the DB I am doing so as an admin hence all security rules get ignored.
import * as functions from 'firebase-functions';
const admin = require('firebase-admin')
admin.initializeApp(functions.config().firebase)
I tired the following but receive an error in my functions log
const nonadmin = require('firebase')
nonadmin.initializeApp(functions.config().firebase);
I am having trouble finding documentation on how to obtain a non admin database reference. I read this post here however that is based off of a trigger and using the returned event object. In my cloud function I am using a post request.