title: Fetch JSON object from Google WebApp from another Google WebApp
body: <p>I have two Google Spreadsheets, each of which with some Apps Script attached. Eventually I want to deploy both as WebApps so they can communicate with one another through their public URLs. For now, I have only deployed one of them so I can test this functionality.</p>
  
  <p>We'll call Script A the one that's deployed as a WebApp and Script B the one that is trying to send a request to Script A's URL. The goal here is for Script A to return a JSON object to Script B.</p>
  
  <p>In Script A, I have this code:</p>
  
  <pre><code>function doGet(request) {
    var data = [[1, 2, 3], [4, 5, 6]]; //dummy JSON object
  
    return ContentService.createTextOutput(JSON.stringify(data))
      .setMimeType(ContentService.MimeType.JSON);
  }
  </code></pre>
  
  <p>In Script B, I have this code:</p>
  
  <pre><code>function pullJSON(URL) {  
    var data = UrlFetchApp.fetch(URL, {"contentType": "application/json"});
  Logger.log(data);
  }
  </code></pre>
  
  <p>When I access Script A's exec URL, I get a JSON object. However, when I run <em>pullJSON()</em> in Script B (feeding it the same URL), the Logger shows a long HTML file filled with metadata (there's no visible content when I view it in my browser). I'm confused as to why this is the case...I know there are a couple of redirects to return JSON, but it is my understanding that the <em>UrlFetchApp.fetch()</em> method defaults to following all redirects.</p>
  
  <p>Could this be an OAuth issue? Script A is published to run as User Accessing the App, though I also tried running it as me.</p>
  
  <p>Thoughts?</p>