title: How to get Firebase ID Token in Firebase Cloud Functions on auth.user().onCreate event?
body: <p><strong>Background</strong></p>
  
  <p>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).</p>
  
  <p>I want to create a Cloud Function that is triggered on User Creation in Firebase (referred <a href="https://youtu.be/pADTJA3BoxE" rel="nofollow noreferrer">this video tutorial</a>). 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.</p>
  
  <p><strong>Question</strong></p>
  
  <p>How do I get current user's ID Token inside Cloud Function?</p>
  
  <p>A related post <a href="https://stackoverflow.com/questions/44046705/using-firebase-id-token-in-firebase-cloud-functions">here</a> 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.</p>
  
  <p>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.</p>
  
  <p>Sorry if its a noob question. I am new to Javascript and NodeJs. Any pointers will be of great help!</p>
  
  <p>Also, I am not using Custom Tokens.</p>
  
  <p>Thanks!</p>