firebase-admin

Delete Folder from Firebase Storage using Google Cloud Storage

青春壹個敷衍的年華 提交于 2019-12-04 01:42:55
问题 I want to delete the folder "test" and everything that is in it. I am sucessfuly able to delete the folder and all it's contents/subfolders in FirebaseStorage with the terminal using this code: gsutil rm -r gs://bucketname.appspot.com/test/** However when I tried to do it in java, it does not work. Storage storage = StorageOptions.getDefaultInstance().getService(); String bucketName = "bucketname.appspot.com/test"; Bucket bucket = storage.get(bucketName); bucket.delete(Bucket

Firebase Admin SDK - Current Logged In User - Nodejs

时光怂恿深爱的人放手 提交于 2019-12-03 20:28:32
How do i get currentUser in firebase admin SDK. In client SDK we can use onAuthStateChanged() or firebase.auth().currentUser() In NodeJs Server.js file firebase admin SDK onAuthStateChanged() Do not work, what should work here? Basically i want only logged in users to access my innerPages so i am using express,nodejs app.get method to create routes. app.get('/', authenticationRequired ,function(req,res){ res.sendFile(path.join(__dirname+'/index.html')); }); And trying to write authenticationRequired method (returns false or true depending on if user is logged in). The Firebase Admin SDK does

How to properly exit firebase-admin nodejs script when all transaction is completed

两盒软妹~` 提交于 2019-12-03 19:28:43
问题 Is there anyway to check if all firebase transaction is completed in firebase-admin nodejs script, and properly disconnect from firebase and exit the nodejs script? Currently, the firebase-admin nodejs script will just keep running even after all the transaction has been completed. 回答1: If you're keeping track of all the promises and they complete successfully, what's happening is that the app is keeping a connection open, you can kill the app, by using: app.delete() For example if you used

Google App Engine - Node: Cannot find module 'firebase-admin'

淺唱寂寞╮ 提交于 2019-12-03 16:44:23
问题 First time deploying a GAE app here, I'm trying to follow this tutorial: https://firebase.googleblog.com/2016/08/sending-notifications-between-android.html (see node code section). I ran npm install firebase-admin --save npm install request --save on my machine, the package.json is here, but when I use gcloud app deploy , I get these logs when opening the app on my browser: 2017-02-10 09:35:02 default[20170210t103151] module.js:471 2017-02-10 09:35:02 default[20170210t103151] throw err; 2017

What's the difference between the firebase and the firebase-admin npm module?

可紊 提交于 2019-12-03 08:19:36
问题 I want to build a Node.js web app using Firebase (authentication, database and storage). But I get confused on which module should I use, firebase or firebase-admin (or both). 回答1: The admin SDK runs your code with administrative permissions. This means it bypasses the security rules of your Firebase Database. It also has functionality to manage users and mint custom tokens and can be used to send FCM messages. If you use the regular (non-admin) Firebase module, you're running as a regular

Google App Engine - Node: Cannot find module 'firebase-admin'

天大地大妈咪最大 提交于 2019-12-03 05:48:28
First time deploying a GAE app here, I'm trying to follow this tutorial: https://firebase.googleblog.com/2016/08/sending-notifications-between-android.html (see node code section). I ran npm install firebase-admin --save npm install request --save on my machine, the package.json is here, but when I use gcloud app deploy , I get these logs when opening the app on my browser: 2017-02-10 09:35:02 default[20170210t103151] module.js:471 2017-02-10 09:35:02 default[20170210t103151] throw err; 2017-02-10 09:35:02 default[20170210t103151] ^ 2017-02-10 09:35:02 default[20170210t103151] 2017-02-10 09:35

Firebase REST auth when creating token with node.js admin sdk

假如想象 提交于 2019-12-03 00:18:26
I know this issue was asked a lot here, but I still cannot seem to find the exact answer that can solve my problem. I wish to access Firebase using REST calls, by adding an access_token param. The access_token is created using the Node.js Admin SDK, using the following code: var admin = require("firebase-admin"); var serviceAccount = require("./pk.json"); admin.initializeApp({ credential: admin.credential.cert(serviceAccount), databaseURL: "https://XXX.firebaseio.com" }); var uid = "1234"; admin.auth().createCustomToken(uid) .then(function(customToken) { // Send token back to client console

How to authenticate an user in firebase-admin in nodejs?

两盒软妹~` 提交于 2019-12-02 22:52:55
At the moment I am creating a Firebase API on nodejs. I would like to handle all Firebase stuff (like authentication) with firebase-admin on nodejs. But what is the correct way to authenticate a user over nodejs in firebase-admin without the Javascript Firebase SDK on the client side? On the official documentation for admin I didn't find a function called signInWithEmailAndPassword (like as on the client side SDK) for nodejs. There is only a function called: " getUserByEmail ", but this function doesn't check if the user has entered the correct password. This is my form: <form class="sign-box"

Why aren't all my documents updated in Firestore?

对着背影说爱祢 提交于 2019-12-02 17:43:32
问题 I'm using python for trying to add a field to more than 750 documents in a firestore collection, but when trying to do this, only my first 55 documents get updated. I'm assuming this happens because of the firestore write limits but don't really get why. COLLECTION STRUCTURE Note: actividades is an array with a size around of 20 elements and each element has only 3 properties. CODE import firebase_admin from firebase_admin import credentials, firestore cred = credentials.Certificate(

AWS Lambda using firebase-admin initializeApp timeout

别说谁变了你拦得住时间么 提交于 2019-12-02 11:40:24
问题 I use Lambda to Firebase message. I ref this. But the lambda function still timeout because it cannot connect to google server. Handler.js / [START imports] const firebase = require('firebase-admin'); const serviceAccount = require("../serviceAccount.json"); module.exports.message = (event, context, callback) => { context.callbackWaitsForEmptyEventLoop = false; const registrationToken = "xxxxxxx"; const payload = { data: { score: "850", time: "2:45" } }; // [START initialize] if(firebase.apps