title: Verify a Purchase using Firebase Functions
body: <p>I want to verify purchases in my app using Firebase Functions and <a href="https://developers.google.com/android-publisher/api-ref/purchases/products/get" rel="noreferrer">Purchases.products: get</a>
  But I don't know how to use the authorization Scope from the link or how to build the request in Firebase Functions.
  This is what I have so far:</p>
  
  <pre><code>const functions = require('firebase-functions');
  const admin = require('firebase-admin');
  const google = require("googleapis");
  const publisher = google.androidpublisher('v2');
  admin.initializeApp(functions.config().firebase);
  
  exports.validatePurchases = functions.database
      .ref('/purchases/{uId}/{orderId}')
      .onWrite((event) =&gt; {
          const purchase = event.data.val();
          const token = purchase.token;
          const packageName = purchase.package_name;
          const sku = purchase.sku;
          const signature = purchase.signature;
          const uri = "https://www.googleapis.com/androidpublisher/v2/applications/" + packageName + "/purchases/products/" + sku + "/tokens/" + token;
  
          return TODO;
      });
  </code></pre>
  
  <p>I have setup mostly everything but my JavaScript knowledge is very limited and don't know how to build the Request and get the Result in Firebase Functions</p>