Questions tagged [firebase-admin]

The Firebase Admin SDK is a set of client libraries which enable App Developers to write more custom behavior for their apps by providing server technologies access to Firebase APIs. Currently, there are libraries for Node.js, Java, Python and Go.

Firebase Admin SDK grants elevated privileges on the server-side, to features like:

  • Firebase Database (Realtime Database and Cloud Firestore)
  • Firebase Authentication
  • Firebase Storage
  • Firebase Cloud Messaging
2205 questions
12
votes
2 answers

How to remove data with firebase-admin?

So, I'm using this firebase-admin library here. I read the docs from Firebase here. But I can't find the section how to remove the data with firebase-admin. I do something like this, but it doesn't work: router.get('/delete_category', function(req,…
11
votes
2 answers

Firebase Admin gives error ECONNREFUSED on connecting to Auth Emulator

I am trying to list all users of my Firebase project using Firebase Admin SDK. The below func to list users works fine when listing from Cloud Auth Service. const admin = require('firebase-admin'); const serviceAccount =…
kernelman
  • 992
  • 1
  • 13
  • 28
11
votes
2 answers

Delete all users from the new firebase auth emulator

I'm playing around with the new firebase auth emulator (on the node admin SDK), and have made some tests that run perfectly if I manually delete the created users between each test, but I can't seem to automatically delete them? I've used the…
XBullet123
  • 471
  • 6
  • 20
11
votes
5 answers

How can I generate access token to file uploaded to firebase storage?

I'm able to upload a file to my firebase storage bucket via nodejs using the firebase-admin but when I go to the firebase UI I cannot open the file. I noticed that uploaded files via firebase UI will have an access token automatically generated but…
Rofls
  • 139
  • 1
  • 1
  • 7
11
votes
2 answers

Verifying ID tokens with Firebase Authentication

We are starting the development of a web app and were thinking of using Firebase Authentication to handle our sign up flow. However, we are unsure about how the ID token verification works. It seems possible to verify a user with its token outside…
Alex
  • 1,021
  • 3
  • 10
  • 16
11
votes
2 answers

Check If Firebase User Exist Without Throwing Error

I have a website that offers a simple messaging service. Individuals can pay for the service, or a business can pay for a monthly subscription and then add their clients/users for free. When the business adds a client/user email, that triggers the…
Will
  • 605
  • 2
  • 11
  • 23
11
votes
2 answers

After deploy Cloud Functions error: Could not refresh access token.

I've been experimenting for a while with Firebase Cloud Functions, today I made a minor change to my index.json file (added a field to a document to be set), after deploying on the Firebase Console > Functions > Logs I've got this weird errors: Auth…
ran3000
  • 186
  • 1
  • 13
11
votes
3 answers

Get Public URL from file uploaded with firebase-admin

I use firebase-admin and firebase-functions to upload a file in Firebase Storage. I have this rules in storage: service firebase.storage { match /b/{bucket}/o { match /images { allow read; allow write: if false; } } } And I…
SaroVin
  • 1,583
  • 3
  • 23
  • 46
11
votes
1 answer

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

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,…
Ran
  • 1,089
  • 1
  • 12
  • 30
10
votes
0 answers

firebaseAdmin.auth().getUser(uid) being extremely slow recently

Starting around October firebaseAdmin.auth().getUser(uid) is having an extremely slow response time - often reaching more than 60 secs and even more - and then it returns back to normal. My first suspicion was it's related to the throughput of the…
10
votes
2 answers

NodeJS + Google Login + Firebase Functions results in decoding firebase session cookie failed

I require a Google Sign-In for a Firebase application, to get this done I used multiple sources: auth-sessions provides a good out of the box example with NodeJS + Firebase + Google Login. manage firebase session provides a sample NodeJS functions…
10
votes
1 answer

firebase - App Check fails when accessing database from callable cloud function

I recently enabled App Check for my firebase app and enforced it on both my cloud functions and database. The cloud function workflow is behaving correctly. However, I can no longer access the database from the function. A minimal version of my…
10
votes
4 answers

Firebase Firestore Increment FieldValue does not increment

so i've read all the documentation everything about increment a counter in a Firestore database. I have this code const admin = require("firebase-admin"); const db = admin.firestore(); ... db .collection("settings") .doc("totalUsers") .set({ count:…
10
votes
4 answers

Firebase Admin SDK global app initialization in Node.js

I am building an Express.js app, using the Firebase Admin SDK for several features such as ID Token validation and Cloud Firestore access. In my main app.js file, I am initializing the app as: const admin = require('firebase-admin') const…
10
votes
2 answers

Using firebase-admin. What are service account credentials used for?

I'm building a cloud function to get some documents and generate an HTML response. And right now what I have is: myFunction.js import * as admin from 'firebase-admin'; import serviceAccount from './someServiceAccountKey.json'; // OPTION #1 …