Background
I have some Endpoint APIs on App Engine. I am able to authenticate the Firebase User in my Endpoint API when making a call from my client. (I append the Bearer token to HTTP request header when making the call).
I want to create a Cloud Function that is triggered on User Creation in Firebase (referred this video tutorial). From this Cloud Function, I want to call an Endpoint API using HTTP Request. For the HTTP API call to work, I need to send a Firebase Token in the request header.
Question
How do I get current user's ID Token inside Cloud Function?
A related post here recommends that I should call the API from my Ionic/Angularjs client. However, that will be a roundtrip back to the client and then to Endpoints. I am trying to avoid that.
I found that in /node_modules/firebase-admin/lib/firebase-app.js, there is a call to "FirebaseAppInternals.prototype.getToken". But I am not sure how to call it from my Cloud Function.
Sorry if its a noob question. I am new to Javascript and NodeJs. Any pointers will be of great help!
Also, I am not using Custom Tokens.
Thanks!