firebase-admin

How to make Firebase Functions act as a user instead of being an admin?

荒凉一梦 提交于 2019-12-10 14:47:08
问题 My client app is accessing to Firestore through API created by Firebase Functions. However, the Firebase Functions imports firebase-admin which bypass all the defined security rule. Is there any way I can make my HTTP triggers Function to act as a specific user (for example, by passing an access token from client to server), so that the Functions works under influence of Firebase Functions as well. 回答1: There is currently no way to do this. The Firestore SDK for node doesn't have a way of

Firebase suddenly reports invalid signature

不想你离开。 提交于 2019-12-10 11:37:40
问题 We are current hosting a Java/Spring server including firebase ID token verification on SAP Cloud Platforms (Hana Cloud). The authentication worked fine for the last few month, but suddenly stopped working yesterday, then it recovered after ~30 minutes and today it suddenly stopped working again. The error always is: java.util.concurrent.ExecutionException: com.google.firebase.auth.FirebaseAuthException: Firebase ID token has invalid signature. See https://firebase.google.com/docs/auth/admin

Firebase Admin Java SDK not doing any operation

浪子不回头ぞ 提交于 2019-12-10 10:45:15
问题 I've setup the firebase admin SDK using this guide So I'm initializing it in the following way. InputStream refreshToken = new ClassPathResource(CONFIG_FILE).getInputStream(); FirebaseOptions options = new FirebaseOptions.Builder() .setCredential(FirebaseCredentials.fromRefreshToken(refreshToken)) .setDatabaseUrl("https://<project-id>.firebaseio.com/") .build(); FirebaseApp.initializeApp(options); I got no errors to this point, everything seems fine. However, I'm unable to do any operations.

Build Fail with 'com.android.tools.r8.utils.AbortException: Error: Program type already present: com.google.firebase.FirebaseApp'

♀尐吖头ヾ 提交于 2019-12-09 03:51:08
问题 Hello when i implementing implementation 'com.google.firebase:firebase-admin:6.8.0' I am getting the error like Caused by: com.android.tools.r8.utils.AbortException: Error: Program type already present: com.google.firebase.FirebaseApp I have tried the below steps Clear Project Invalid catch and restart Rebuild But still getting same error. I i removed com.google.firebase:firebase-admin:6.8.0 then i work well without it. Here my app/build.gradle apply plugin: 'com.android.application' apply

FIREBASE WARNING: Invalid query string segment: [closed]

六眼飞鱼酱① 提交于 2019-12-08 21:44:43
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I keep having these warnings in the Firebase Logs Console: "FIREBASE WARNING: Invalid query string segment:" I checked everything but I can't find some reasons. Do you have any ideas ? Configuration { "name": "functions", "description": "Cloud Functions for Firebase", "dependencies": { "firebase-admin": "~5.8.1",

how to set server time stamp with firestore admin nodejs sdk?

£可爱£侵袭症+ 提交于 2019-12-08 18:46:42
问题 const firebase = require('@firebase/app').default; require('@firebase/firestore') const admin = require('firebase-admin') const functions = require('firebase-functions') // initialize the admin SDK... exports.setUpdatedDate = functions.firestore.document('/foos/{fooId}/bars/{barId}') .onCreate(event => { admin.firestore().collection('foos').doc( event.params.fooId ) .set({ updatedDate: firebase.firestore.FieldValue.serverTimestamp() }, {merge:true}) }) Running the function shell above and I

How can I return a nested firebase query/promise in express?

戏子无情 提交于 2019-12-08 13:01:41
问题 I am working on NodeJS with firebase-admin. I've structured my firebase database like this user node: user | +--- uid (-27JfjDfBetveYQNfStackOverFlow) | +-- firstname +-- lastname +-- mainCompanyId: '' +-- .... userCompanies | +--- uid (-27JfjDfBetveYQNfStackOverFlow) | +--- companyId (-KnStackOverFlowF7DezRD0P) : true +--- companyId (-MyStackOverFlowF99ezRD0V) : true +--- .......... : true companies | +--- companyId (-KnStackOverFlowF7DezRD0P) | +-- name +-- createdAt +-- updatedAt +--

Firebase functions being called twice while running on Google App Engine

淺唱寂寞╮ 提交于 2019-12-08 06:32:08
问题 I am running firebase in a Google App Engine Flexible environment. I have a child added listener set up at a node and it gets called twice every single time I add one child. This only happens when I'm running this code on Google App Engine. If I run it locally, it operates as expected. Here is the code // [START app] 'use strict'; var express = require('express'); var bodyParser = require('body-parser'); var request = require('request'); var firebase = require('firebase-admin'); var app =

Firebase rules allowing write when they shouldn't be

六月ゝ 毕业季﹏ 提交于 2019-12-08 01:04:35
问题 I have the following database entry: "companies: 8": I have the following database rules, which do not allow a simulated write of "companies: 8" to the database. { "rules": { ".read": "auth != null", ".write": "auth != null", "companies": { ".validate": "(data.exists() && (newData.val() === data.val() + 1)) || (!data.exists() && newData.val() == 0)" } } } However, when I try to write "companies: 20" to the database with the Firebase Python SDK, which also is not allowed under these rules, it

Firebase functions being called twice while running on Google App Engine

我们两清 提交于 2019-12-07 08:26:26
I am running firebase in a Google App Engine Flexible environment. I have a child added listener set up at a node and it gets called twice every single time I add one child. This only happens when I'm running this code on Google App Engine. If I run it locally, it operates as expected. Here is the code // [START app] 'use strict'; var express = require('express'); var bodyParser = require('body-parser'); var request = require('request'); var firebase = require('firebase-admin'); var app = express(); firebase.initializeApp({ credential: firebase.credential.applicationDefault(), databaseURL: