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
97
votes
10 answers

How do I get the server timestamp in Cloud Functions for Firebase?

I know you can pull the server timestamp in web, ios, and android - but what about the new Cloud Functions for Firebase? I can't figure out how to get the server timestamp there? Use case is me wanting to timestamp an email when it arrives. On web…
59
votes
4 answers

Firestore Add value to array field

Im trying to use Firebase cloud functions to add the id of a chatroom to the users document in an array field. I cant seem to figure out the way to write to an array field type. here is my cloud function exports.updateMessages =…
49
votes
1 answer

What's the difference between the firebase and the firebase-admin npm module?

I want to build a Node.js web app using Firebase (authentication, database and storage). But I get confused on which module should I use, firebase or firebase-admin (or both).
48
votes
5 answers

Requested entity was not found when trying to send a push notification using Firebase Cloud Messaging in Firebase Cloud Functions

I'm trying to send a multicast notification via FCM from a Firebase Cloud function with the following code: const message = { tokens: recipients, notification: { title: title, body: body }, data: { …
Sebastien
  • 3,583
  • 4
  • 43
  • 82
35
votes
4 answers

How to authenticate an user in firebase-admin in nodejs?

At the moment I am creating a Firebase API on nodejs. I would like to handle all Firebase stuff (like authentication) with firebase-admin on nodejs. But what is the correct way to authenticate a user over nodejs in firebase-admin without the…
Harry
  • 489
  • 1
  • 5
  • 13
34
votes
5 answers

Firebase Authentication: 'HTTPResponse' object has no attribute 'strict', status: error

I'm a tad baffled as to why this bit of code has suddenly decided to fail when it had been working fine for a week. import firebase_admin from firebase_admin import firestore, credentials,db, auth def userIsLoggedIn(self,id_token: str) ->…
Reddspark
  • 6,934
  • 9
  • 47
  • 64
33
votes
9 answers

How can I update more than 500 docs in Firestore using Batch?

I'm trying to update a field timestamp with the Firestore admin timestamp in a collection with more than 500 docs. const batch = db.batch(); const serverTimestamp = admin.firestore.FieldValue.serverTimestamp(); db .collection('My Collection') …
33
votes
2 answers

How to verify users current password?

So, maybe I missed this somewhere in the docs but I couldn't find anything of the sort. I wan't my users to have to type in their current password to be able to create a new one. From what I understand if the user is authenticated he is able to…
ThatBrianDude
  • 2,952
  • 3
  • 16
  • 42
32
votes
1 answer

Getting a Cloud Firestore document reference from a documentSnapshot

The issue I'm trying to retrieve the document reference from a query. My code returns undefined. I can get the path by extracting various parts of documentSnapshot.ref, but this isn't straightforward. What I'd like to return is a reference which I…
29
votes
9 answers

FIrebase deploy error: Cannot find module 'firebase-admin'

I recently started getting the error below when trying to deploy to Firebase (after having done so successfully in the past). I'm not sure what might have changed for this to start occurring. If I run firebase serve to serve on the localhost,…
Feyman81
  • 410
  • 1
  • 4
  • 14
29
votes
1 answer

NodeJS authentication with Firebase

I would like to authenticate and keep sessions via NodeJS with Firebase. Client can't directly communicate with Firebase. In short: Client (browser) <----> NodeJs(firebase-admin) <----> Firebase I created Firebase client in NodeJS, then I used…
karolinski
  • 577
  • 1
  • 6
  • 18
28
votes
4 answers

Cloud Functions: How to copy Firestore Collection to a new document?

I'd like to make a copy of a collection in Firestore upon an event using Cloud Functions I already have this code that iterates over the collection and copies each document const firestore =…
Khaled
  • 542
  • 1
  • 5
  • 10
27
votes
1 answer

Generate private key Firebase Admin SDK

I'm very new to Firebase, and I need a private key to access the Firebase Admin SDK for my backend. Actually, my company has been using Firebase for a long time, but no one knows where the private key is or if it has been generated. Here are my…
25
votes
1 answer

"Caller does not have permission" trying to create custom token with Firebase Admin SDK

Error When calling admin.auth().createCustomToken() I am getting the following error: Error: The caller does not have permission; Please refer to https://firebase.google.com/docs/auth/admin/create-custom-tokens for more details on how to use and…
23
votes
4 answers

Unable to resolve path to module 'firebase-admin/app' (ESLint)

I'm was trying to connect to my Firebase app by following the docs, but ESLint is complaining. I have already checked a related question, but the solutions proposed there doesn't seem to work for me. I have the following .eslint.js…
Anthony Luzquiños
  • 739
  • 11
  • 23
1
2 3
99 100