firebase-admin

Some Firebase security rules apply for admin in Cloud Functions

删除回忆录丶 提交于 2019-12-12 07:16:18
问题 Cloud Function gets a firebase permission denied error when updating or removing. The service account is initialized with credentials from a file in order to use auth.createCustomToken which isn't currently available for the default account admin = require('firebase-admin'); functions = require('firebase-functions'); credential = admin.credential.cert(require('./credentials.json')); admin.initializeApp({credential: credential, databaseURL: functions.config().firebase.databaseURL}); The

How do I correctly add the file input stream to my Firebase JSON file [duplicate]

会有一股神秘感。 提交于 2019-12-12 03:54:46
问题 This question already has answers here : error: unreported exception FileNotFoundException; must be caught or declared to be thrown (4 answers) Closed 2 years ago . My JSON file resides in the projects root folder, I have correctly set up the dependencies and now I'm trying to add the JSON file Using the instructions as provided by Firebse themselves here. Here is the code from my main java file: import com.google.firebase.FirebaseApp; import com.google.firebase.FirebaseOptions; import com

Firebase Admin when I add a user email is anonymous

青春壹個敷衍的年華 提交于 2019-12-12 03:44:00
问题 IM using the new firebase admin SDK for node js and I created an api where I can add users. Everything is working fine but when I see a new user in my firebase dashboard I find Anonymous. 回答1: When you create a custom authentication token with Firebase Admin SDK, those users are not shown in the Firebase Authentication console. 来源: https://stackoverflow.com/questions/42000449/firebase-admin-when-i-add-a-user-email-is-anonymous

Get public download URL from uploaded file in firebase storage with Java rest API

邮差的信 提交于 2019-12-11 17:18:13
问题 I would like to get the download URL from a file (Blob) upload by firebase-admin sdk for java. My Code: FirebaseOptions options = new FirebaseOptions.Builder() .setCredentials(GoogleCredentials.fromStream(serviceAccount)) .setDatabaseUrl("...") .build(); FirebaseApp app = FirebaseApp.initializeApp(options); StorageClient storage = StorageClient.getInstance(app); Bucket bucket = storage.bucket("..."); Blob blob = bucket.create(...); so, by this code I am able to upload file in firebase storage

Import only used bits from firebase-admin when using Typescript in Cloud Functions

妖精的绣舞 提交于 2019-12-11 15:54:01
问题 I glanced at my transpiled code from cloud functions and following typescript import import { auth, firestore } from 'firebase-admin'; is transpiled to const firebase_admin_1 = require("firebase-admin"); Looking at this it imports whole admin library as opposed to just bits I need and I assume this will contribute to bigger cold start times. I tried to require these in my ts code using require i.e. const { auth, firestore } = require('firebase-admin'); but doing so makes it loose it's type

(How) can you log a user out of firebase?

丶灬走出姿态 提交于 2019-12-11 15:26:25
问题 We're using Firebase for our user authentication. I can log a user in on the client side and then run the following from a python app: import firebase_admin import firebase_admin.auth from firebase_admin import credentials from datetime import datetime cred = credentials.Certificate('my_creds.json') app = firebase_admin.initialize_app(cred) firebase_admin.auth.revoke_refresh_tokens('some-user-id', app=app) u = firebase_admin.auth.get_user('some-user-id') print(datetime.fromtimestamp(u.tokens

App Engine - LoggerFactory Restricted Class Error When Using Firebase in Java

五迷三道 提交于 2019-12-11 15:13:05
问题 I'm creating a backend for my Android application using Google App Engine. I'm doing something very simple, which is just initialising my Firebase Admin SDK following instructions here - https://firebase.google.com/docs/admin/setup. When I do this and run, I get the following error: java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory is a restricted class. Please see the Google App Engine developer's guide for more details. at com.google.appengine.tools.development.agent.runtime.Runtime

Is there a way to get a firebase element from a certain index?

久未见 提交于 2019-12-11 15:12:28
问题 I have a list of chat messages that are ordered by timestamp and have a unique firebase key (made by the push operator) In this list I want to get the message at position 100 from the end without knowing its key. Is there a way to do this? I tried using the filtering methods limitToLast() and limitToFirst together which created an error, saying a filter was already set. The current way I do it is by downloading all 100 messages with: admin.database().ref("path/to/messages").limitToLast(100)

Warning, FIREBASE_CONFIG and GCLOUD_PROJECT environment variables are missing. Initializing firebase-admin will fail

烂漫一生 提交于 2019-12-11 14:29:30
问题 I am using this tutorial, to setup firebase admin SDK. https://firebase.google.com/docs/admin/setup I have downloaed a json file (service account) from firebase console. It is under the the path: C:\ct\functions\src\cargo-tender-firebase-adminsdk-8e307-c6b82762d2.json I have set an environment variable: GOOGLE_APPLICATION_CREDENTIALS=C:\ct\functions\src\cargo-tender-firebase-adminsdk-8e307-c6b82762d2.json And when I run the script, I receive the following Warning: Warning, FIREBASE_CONFIG and

FCM send msg through firewall using firebase-admin library

吃可爱长大的小学妹 提交于 2019-12-11 11:51:46
问题 In company we have firewall. We've enabled fcm.googleapis.com 433 adress. But it havent helped. Still jboss application can not send push request using com.google.firebase:firebase-admin library. I know about range of IPs but that is not possible for admins to maintain such range of IPs in our company. But we can set it for url names (I was told so). But this one addres havent helped. I've looked into com.google.firebase:firebase-admin com.google.auth:google-auth-library-oauth2-http And found