Callable Cloud Functions? How callable Firebase Cloud Functions work

This lesson is available for PRO members or as a single course purchase. Sign-in and choose a plan below.
Get Unlimited PRO Access

OR


*Enrollment provides full access to this course (and updates) for life.

Git Branch 3

file_type_typescript index.ts
import * as functions from 'firebase-functions';

export const testFunction = functions.https.onCall( async (data, context) => {
    const uid  = context.auth && context.auth.uid;
    const message = data.message;

    return `${uid} sent a message of ${message}`
});

Callable functions make it possible to call HTTP cloud functions with the user’s Firebase auth context. This can dramatically simplify our code because it means we no longer need to manually validate auth headers in our cloud functions.

command line
firebase init hosting 

firebase deploy --only functions

firebase serve

Questions?

Ask questions via GitHub below OR chat on Slack #questions