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
23
votes
7 answers

The incoming JSON object does not contain a client_email field

I'm trying to create a firebase cloud function. So I would to run my firebase cloud function locally. But it do not work how to setup authentication. I have installed firebase tools : https://firebase.google.com/docs/functions/local-emulator I've…
23
votes
6 answers

How to force logout firebase auth user from app remotely

I have a project which uses firebase auth with firebaseUI to authenticate users. I have enabled Google, Facebook and email providers. What I need is to remotely logout or disable some of the users. I want the users to logout from the app on doing…
Ashwin Valento
  • 878
  • 1
  • 7
  • 14
23
votes
5 answers

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

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.
23
votes
2 answers

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

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…
Andrew See
  • 1,062
  • 10
  • 21
22
votes
2 answers

Restrict firestore access to admin-sdk

I am designing an application (let's call it a TodoList app) based on VueJs (for the UI) + NodeJs (for the backend, which will run in Google Cloud Platform) + Firestore (for the auth + database). I have wandered through the huge documentation of…
22
votes
9 answers

How can I list all users using firebase admin sdk

Is there a way to list all the users using the firebase admin sdk? Documentation only shows getting one user either by uid or email.
vincent nyanga
  • 386
  • 1
  • 2
  • 6
21
votes
7 answers

firebase-admin with typescript in firebase cloud functions

I am using firebase cloud functions with javascript on cloud functions. And, I want to switch from javascript to typescript. However I cannot use firebase-admin on typescript as following command failed. command: npm install @types/firebase-admin…
20
votes
3 answers

Firebase Messaging v1 401 Project Not Permitted error

I am running a node server with the firebase admin sdk. However, everytime I try to send a push notification from the server, I get a 401 error. Here's the exact error I'm getting: errorInfo: { code: 'messaging/authentication-error', message: 'An…
Tlal
  • 591
  • 1
  • 6
  • 14
20
votes
8 answers

firebase admin SDK create user and send verification email

How can I send a verification email after I create a user with firebase admin SDK? I am trying to combine createUser function and sendEmailVerification function could somebody indicate a hint or an answer? thanks update: the user creation is being…
passion
  • 1,000
  • 6
  • 20
  • 47
19
votes
4 answers

Upload File to Firebase Storage using Admin SDK

According to the Docs, I have to pass the filename to the function in order to upload a file. // Uploads a local file to the bucket await storage.bucket(bucketName).upload(filename, { // Support for HTTP requests made with `Accept-Encoding: gzip` …
18
votes
2 answers

Firebase admin SDK FCM error Exactly one of topic, token or condition is required

I am fixing an error message which occurred, but it also used to work before. I am sending FCM notification with multiple tokens and am getting the following error 0|api | 2020-2-11 13:26:26 [ExceptionsHandler] Exactly one of topic, token or…
18
votes
5 answers

Firebase messaging/mismatched-credential

I'm trying to send notifications to a specific device with Firebase but am getting the following error: {"r": {"results":[{"error":{"code":"messaging/mismatched-credential","message":"The credential used to authenticate this SDK does not have…
18
votes
5 answers

How to access multiple Realtime Database instances in Cloud Functions for Firebase

I'm using multiple databases in a Firebase project. Cloud functions for the main (default) database work great, however, I cannot make them work for a secondary database. For example I want to make a read request on a node with admin…
18
votes
3 answers

Is there a way to send the verification email with the Firebase Admin SDK from my Node.js server?

Is there a way to send the email verification email from my server ? This is how it's done on the client: authData.sendEmailVerification().then(function() { Is there a way to do it on the server ?
TheProgrammer
  • 1,409
  • 4
  • 24
  • 53
18
votes
2 answers

Verifying firebase custom token to get token ID fails when using jsonwebtoken

On the backend a custom token is generated via firebase's admin SDK thusly: router.use('/get-token', (req, res) => { var uid = "big-secret"; admin.auth().createCustomToken(uid) .then(function(customToken) { res.json({ …
Harry Lincoln
  • 614
  • 2
  • 9
  • 30