firebase-admin

Import json file from Firebase Admin SDK

廉价感情. 提交于 2019-12-02 11:31:38
问题 I can update the whole database (Real Database) by importing a json file in Firebase Console: How can I do it programmatically from server side (with Firebase Admin)? I tried private void uploadFirebaseDatabaseFile(JsonObject jsonObject) { // As an admin, the app has access to read and write all data, regardless of Security Rules DatabaseReference ref = FirebaseDatabase.getInstance().getReference(); ref.setValue(jsonObject, (error, ref1) -> System.out.println(error + " " + ref1)); } But it

Why aren't all my documents updated in Firestore?

杀马特。学长 韩版系。学妹 提交于 2019-12-02 11:26:53
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('avancesAccountKey.json') default_app = firebase_admin.initialize_app(cred) db = firestore.client() count = 0

change Dom element based on firebase admin value events

大兔子大兔子 提交于 2019-12-02 08:41:34
I have a simple HTML page printed out inside a Servlet. Here I have setup firebase admin sdk and have set a value event listener for a path. When the events fire, I wish to change a Div element and display the results there. EDIT: The listener does work on further testing with logs. But I still do not know how to reflect the changes inside the div element as the Listeners are Asynchronous. That's most likely why the script isn't working. Can someone please guide me as to what I should do. The code is as follows: import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter

Can't get list of users using Admin SDK Firebase

倾然丶 夕夏残阳落幕 提交于 2019-12-02 07:49:28
问题 If I add to the Firebase cloud functions, I cannot get a list of users. I have tried many things, and followed the guide on firebase documentation, but it just keeps running, but never loading. exports.listAllUsers = functions.https.onRequest((data, context) => { // List all users return listAllUsers(); }); function listAllUsers() { // List batch of users, 1000 at a time. var allUsers = []; return admin.auth().listUsers() .then(function (listUsersResult) { listUsersResult.users.forEach

Java 8 Firebase Tasks.await()

坚强是说给别人听的谎言 提交于 2019-12-02 06:59:14
问题 I'm using Firebase JAVA sdk in my Spring Boot application. Trying to verify a firebase token: Map resp = new HashMap(); Task<FirebaseToken> task = FirebaseAuth.getInstance().verifyIdToken(info.getToken()) .addOnSuccessListener(new OnSuccessListener<FirebaseToken>() { @Override public void onSuccess(FirebaseToken decodedToken) { logger.info(decodedToken.getClaims()); String uid = decodedToken.getUid(); User user = userDao.loadUserByUID(uid); if (user == null) { ........... }

Will firebase-admin-node start to return date's as Timestamp from firestore?

此生再无相见时 提交于 2019-12-02 05:33:31
问题 In my team we are using firebase/firestore in an Angular application, powered by firebase functions. It works great! Currently we are converting our code in the Angular application, because firestore now returns date's as Timestamp (and not js-dates). Is this something that firebase-admin-node will do as well - or will it stick to js-dates? 回答1: While we don't have a timeline for you, we are planning to expose Timestamps via the Firebase Admin SDK as well. I will update this post as we get

Import json file from Firebase Admin SDK

我们两清 提交于 2019-12-02 05:20:32
I can update the whole database (Real Database) by importing a json file in Firebase Console: How can I do it programmatically from server side (with Firebase Admin)? I tried private void uploadFirebaseDatabaseFile(JsonObject jsonObject) { // As an admin, the app has access to read and write all data, regardless of Security Rules DatabaseReference ref = FirebaseDatabase.getInstance().getReference(); ref.setValue(jsonObject, (error, ref1) -> System.out.println(error + " " + ref1)); } But it throws java.lang.RuntimeException: java.lang.reflect.InvocationTargetException ... Caused by: java.lang

Firestore: get document back after adding it / updating it without additional network calls

久未见 提交于 2019-12-02 04:39:43
问题 Is it possible to get document back after adding it / updating it without additional network calls with Firestore, similar to MongoDB? I find it stupid to first make a call to add / update a document and then make an additional call to get it. 回答1: As you have probably seen in the documentation of the Node.js (and Javascript) SDKs, this is not possible, neither with the methods of a DocumentReference nor with the one of a CollectionReference. More precisely, the set() and update() methods of

Can't get list of users using Admin SDK Firebase

女生的网名这么多〃 提交于 2019-12-02 04:18:00
If I add to the Firebase cloud functions, I cannot get a list of users. I have tried many things, and followed the guide on firebase documentation, but it just keeps running, but never loading. exports.listAllUsers = functions.https.onRequest((data, context) => { // List all users return listAllUsers(); }); function listAllUsers() { // List batch of users, 1000 at a time. var allUsers = []; return admin.auth().listUsers() .then(function (listUsersResult) { listUsersResult.users.forEach(function (userRecord) { // For each user var userData = userRecord.toJSON(); allUsers.push(userData); });

Firebase-Admin, importing it to react application throws Module not found error

巧了我就是萌 提交于 2019-12-02 02:44:08
I'm developming simple React application which uses firebase admin. I have generated react application by using create react app . Then I have installed firebase-admin by using this npm command: npm install firebase-admin --save In my index.js I have added this import: import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; import registerServiceWorker from './registerServiceWorker'; import * as admin from 'firebase-admin' ReactDOM.render(<App />, document.getElementById('root')); registerServiceWorker(); When I launch with npm start command and open my page I get