If you’re using a Firebase functions “onCall” methods, you’re just able to use “req.auth” directly, when you have to return a response to user’s REST call.
But, if you’re using Firebase functions “onRequest” method, you need some additional work to make sure if the caller is a real user has been authenticated with Firebase Authentication.
You have to include an id token when the user requests your API. It generated by calling “getIdToken” method. If you have to…