I am having trouble accessing user information from the Firebase Cloud Functions environment.
What I am trying to do.
const admin = require('firebase-admin') admin.initializeApp() exports.test = functions.https.onRequest(() => { admin.auth().getUser('<user_id>').then(user => { return console.log(user) }).catch(e => { console.error(e) }) }) Now, when I run the test function, I get the following error.
{ code: 'auth/insufficient-permission', message: 'Credential implementation provided to initializeApp() via the "credential" property has insufficient permission to access the requested resource. See https://firebase.google.com/docs/admin/setup for details on how to authenticate this SDK with appropriate permissions.' }, codePrefix: 'auth' } Now, my question is that if it is possible to use admin.auth().getUser from the cloud functions environment.