Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

469
Views
Is there a way to call a Firebase server "function" from within a client app, say with Angular 2?

So Firebase offers something called "functions", which is essentially a nodejs server that has all of the Firebase stuff preconfigured and has all the scaling automatically handled. I'm wondering, is there a way to call a function inside of the "functions" index.js file from an angular 2 app?

I need to utilize the firebase-admin npm module to check if a user's email exists and then grab the uid for that user, if it does.

According to this link, I can setup my index.js file such as:

const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);

// I'm actually not sure if this is how you do this part:
exports.getUserByEmail = (email) => {
  return admin.auth().getUserByEmail(email);
}

Is there a way I can call getUserByEmail() inside of a component in my Angular 2 app?

Thanks in advance!

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

There are two primary ways of invoking a Cloud Function directly from client code.

You can use a database trigger which responds when some location in your Firebase project's Realtime Database changes.

You can also use an HTTP trigger which response when you access an HTTP endpoint. For a web app, you use whatever method you want to invoke an XHR transaction.

Whichever one you use is up to the architecture of your app, and to some degree your preference. There are plenty of samples of both, and more, in the provided sample code.

You can definitely use the Firebase admin SDK to access your project from within your function code. Many of the samples do exactly that.

about 4 years ago · Santiago Trujillo Report

0

Firebase just released a new SDK on March 20 which allows you to call HTTPS trigger like function from the client side and the best part is it checks the user auth so you can restrict the functions to be only called by authenticated users and easily acces their account details such as email,uid,name etc. See more at: https://firebase.google.com/docs/functions/callable

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!