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
8
votes
2 answers

How to use Firebase Auth Admin SDK via Rest Api?

We have been developing a multi platform project which will eventually have an Android app, an iOS app and a web application. We are impressed with the features offered by Google Firebase therefore trying to leverage the opportunities. Since our…
8
votes
3 answers

In firebase authentication, is there a way to remove a custom claim?

In order to set a custom claim, one uses: admin.auth().setCustomUserClaims(uid,{claim:value}); There does exist admin.auth().updateUser(uid,{claim:value}); ...but I'm not exactly clear on how the two are different, and neither one seems to get at…
8
votes
1 answer

Firebase admin.auth().getUser(uid) hangs (NodeJS)

I'm using admin.auth().getUser(uid) in the Firebase Admin SDK (NodeJS), in a Serverless project, and it does successfully return a result. But even though my function returns the result, my lambda still doesn't terminate and I have to use CTRL+C to…
user14764
  • 748
  • 1
  • 9
  • 19
8
votes
1 answer

angular-universal | firebase-admin | code: 'app/invalid-credential' |socket hang up on

import * as admin from 'firebase-admin'; var serviceAccount = require('./keys/keyfile.json'); admin.initializeApp({ credential: admin.credential.cert(serviceAccount), databaseURL: "https://test.firebaseio.com" }); var registrationToken =…
Himanshu Bansal
  • 2,003
  • 1
  • 23
  • 46
8
votes
2 answers

Firebase Admin SDK with Heroku

I am attempting to initialize the Firebase Admin SDK using a Heroku instance running a Java Spring application. The Firebase instructions reference the .json file directly. Initialize the Firebase Admin SDK I do not want to include my admin SDK…
8
votes
2 answers

Firebase Admin NoClassDefFoundError: FirebaseOptions$Builder

I'm using this: FileInputStream serviceAccount; try { serviceAccount = new FileInputStream("firebase_key.json"); } catch (FileNotFoundException e) { System.out.println(e.getMessage()); return; } …
Ali Bdeir
  • 4,151
  • 10
  • 57
  • 117
7
votes
2 answers

How can i generate private key for firebase admin sdk?

I am trying to create new private key for firebase admin sdk, but the button is not available. Can someone guide me on how can i achieve this? Any solution appreciated!
7
votes
1 answer

How to connect Firebase Admin to Emulator Auth

I am struggling to connect to the emulated Firebase Auth service via the Firebase Admin SDK. I cut down the code to really make the problem stand out, and hope someone can help. This is the code of the test.js I run (in NodeJS): // Someone said…
7
votes
1 answer

Changing expected `audience` in firebase-admin's verifyIdToken

We are trying to implement a Google Sign-In button in our mobile app and send the idToken to our NodeJS server to complete the authentication process. The generation of the idToken on the mobile app works as expected but the verification of the…
Guy
  • 12,488
  • 16
  • 79
  • 119
7
votes
2 answers

FCM : getting ' Error: data must be a non-null object' error?

I am trying to send a push notification via Firebase cloud messaging. I am using Firebase admin sdk to send push notification in fcm . I am using nodejs When I am trying to send a push msg , ... I am getting this error { code:…
7
votes
2 answers

Firebase admin Can't read property 'cert' of undefined

I writing a hapi backend api with firebase admin. I can't find a fix for this error. TypeError: Cannot read property 'cert' of undefined at ModuleJob.run (internal/modules/esm/module_job.js:109:37) at async Loader.import…
GrepThis
  • 642
  • 1
  • 11
  • 22
7
votes
1 answer

How to specify sound and click_action in firebase cloud function

I tried with the following function (node.js v8): exports.sendComNotification = functions.firestore .document('Comunicados/{comID}') .onUpdate((snap, context) => { console.log('Com triggered'); const newValue = snap.after.data(); …
7
votes
1 answer

Firebase Admin SDK - Error: Credential implementation provided to initializeApp() ... failed to fetch a valid Google OAuth2 access token

I initialized the SDK Admin in my code, but when I call an admin function it complains about credentials and tokens. Any idea what this could be caused by? var serviceAccount = require('../../../path to the actual json file); admin.initializeApp({ …
7
votes
1 answer

How can I use firebase's firestore/admin sdk with next.js

I am building an application with firebase and next.js I am fairly new to this set up, completely new to SSR, and the firebase docs are confusing me. Currently, I am using firebase functions to run next.js, and that works like a charm. But now, I…
7
votes
1 answer

What is the best way to protect a Google cloud function against a DDOS attack

I'm new in network and I want to protect the layer 7 of a Google cloud function. I've found cloud armour that allow to create an allow/deny ip list for an https load balancer. Also Cloudflare that propose an illimited ddos mitigation. My questions…