firebase-admin

Allowing write access only to Cloud Functions for Firebase

亡梦爱人 提交于 2019-11-27 16:50:45
问题 How can we secure database via the rules that only allow Cloud Functions for Firebase to write data to certain locations, previously there was an option to add uid to admin client databaseAuthVariableOverride and use that uid in rules section, but now we initialise via admin.initializeApp(functions.config().firebase); so I’m not to sure about how to add additional params in. EDIT is it a good idea to initiate with certificate for this instead? i.e admin.initializeApp({ credential: admin

Verify Firebase Token at Google App Engine

本秂侑毒 提交于 2019-11-27 08:19:55
问题 I am developing an Application at Google App Engine. I am using Cloud Endpoints for the communication between an Android App at my Backend at Google App Engine. The Android client uses Firebase Authentication and sends with every call the Firebase token the Cloud Endpoints. At Google App Engine I use the following code to verify the Firebase Token. I am using the Firebase Admin SDK 4.0.3 Task<FirebaseToken> authTask = FirebaseAuth.getInstance().verifyIdToken(token); try { Tasks.await(authTask

How do I get the server timestamp in Cloud Functions for Firebase?

旧巷老猫 提交于 2019-11-27 01:45:43
问题 I know you can pull the server timestamp in web, ios, and android - but what about the new Cloud Functions for Firebase? I can't figure out how to get the server timestamp there? Use case is me wanting to timestamp an email when it arrives. On web it is Firebase.database.ServerValue.TIMESTAMP But that doesn't seem to be available in the functions node server interface? I think it is late and I may be missing the point here... EDIT I am initializing like this admin.initializeApp(functions

Firebase Admin SDK for Android, methods not found

瘦欲@ 提交于 2019-11-26 22:56:51
I'm building an Android app backed by a Firebase app, and I would like to be able to create an Admin account that can edit or delete other user accounts. If I'm understanding correctly, the Firebase Admin SDK should allow me to do this. So I followed the instructions here . To set up the Admin SDK in my app. I added the following to build.app: compile 'com.google.firebase:firebase-admin:4.1.1' And in my Application class, I added this: FileInputStream serviceAccount = null; try { serviceAccount = new FileInputStream("app/<MY-DATABASE>.json"); } catch (FileNotFoundException e) { e

firebase admin SDK create user and send verification email

旧时模样 提交于 2019-11-26 20:58:35
问题 How can I send a verification email after I create a user with firebase admin SDK? I am trying to combine createUser function and sendEmailVerification function could somebody indicate a hint or an answer? thanks update: the user creation is being done by an admin user who is already signed in in the app, so the admin user is just creating users on the dashboad. This is completely different from the registeration methods. update 2: I tried to follow bojeil's answer, I am still stuck with the

The Cloud Functions emulator requires the module “firebase-admin” to be installed

梦想与她 提交于 2019-11-26 17:24:01
问题 Continuing to try to get firebase serve to work again. I just asked this question (and got a good reply, thanks): npm ERR! peer dep missing: firebase-admin@^7.0.0, required by firebase-functions@2.3.1 When doing npm list firebase-admin I now see the expected output -- firebase-admin@7.3.0 . However firebase serve still does not work. I get this: ! Your requested "node" version "6" doesn't match your global version "10" ... ! The Cloud Functions emulator requires the module "firebase-admin" to

Firebase Admin SDK for Android, methods not found

喜你入骨 提交于 2019-11-26 12:46:48
问题 I\'m building an Android app backed by a Firebase app, and I would like to be able to create an Admin account that can edit or delete other user accounts. If I\'m understanding correctly, the Firebase Admin SDK should allow me to do this. So I followed the instructions here. To set up the Admin SDK in my app. I added the following to build.app: compile \'com.google.firebase:firebase-admin:4.1.1\' And in my Application class, I added this: FileInputStream serviceAccount = null; try {

Getting the user id from a database trigger in Cloud Functions for Firebase?

我是研究僧i 提交于 2019-11-26 12:18:43
In the example below, is there a way to get the uid of the user who wrote to /messages/{pushId}/original? exports.makeUppercase = functions.database.ref('/messages/{pushId}/original') .onWrite(event => { // Grab the current value of what was written to the Realtime Database. const original = event.data.val(); console.log('Uppercasing', event.params.pushId, original); const uppercase = original.toUpperCase(); // You must return a Promise when performing asynchronous tasks inside a Functions such as // writing to the Firebase Realtime Database. // Setting an "uppercase" sibling in the Realtime