In my firebase cloud functions I'm often reading a writing data from and to the firebase database. Considering that according to the documentation, functions run with admin privileges. As a result, all my security rules in the DB are bypassed. Considering that some of my functions are essentially API calls (HTTP triggers, etc), I'd like to enforce the DB rules.
Is there a way to use a non-administrative account from the firebase cloud functions?
Current code:
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
const ref = admin.database().ref();
I've tried to use the 'standard' firebase NPM module, but that won't work, deployment fails with some internal error - I guess it was not designed for such use (documentation seems to confirm this).