title: Google Apps Script doGet(e) get user email
body: <p><strong>CURRENTLY</strong></p>
  <p>I want to collect the user email of users accessing my Google Apps Script webapp.</p>
  <p>To achieve this I set Execute as &quot;Me&quot;, with Who has access: &quot;Anyone with Google account&quot;</p>
  <pre class="lang-js prettyprint-override"><code>function doGet(e) {
   let userEmail = Session.getActiveUser().getEmail()
   return HtmlService.createHtmlOutput(
      &quot;&lt;!DOCTYPE html&gt;&lt;html&gt;&lt;body&gt;Email: &quot;+userEmail+&quot;&lt;/body&gt;&lt;/html&gt;&quot;
   );
  }
  </code></pre>
  <p>The deployment then has an EXEC link created:</p>
  <p><code>https://script.google.com/macros/s/1234................56789/exec</code></p>
  <p><strong>ISSUE</strong></p>
  <p>When the execution link is accessed by a user in Incognito window, IE, or Firefox, the user is asked to log in on Google.</p>
  <p>After the user logs in, the page returns:</p>
  <p><code>Email: </code></p>
  <p><strong>WHAT I WANT</strong></p>
  <ol>
  <li>User access <code>exec</code> link, and is prompted to log into google</li>
  <li>After logging into google, user receives HTML:</li>
  </ol>
  <p><code>Email: users@email.com</code></p>
  <p><strong>NOTES</strong></p>
  <p>I recently tried adding:</p>
  <pre><code>  &quot;oauthScopes&quot;: [
      &quot;https://www.googleapis.com/auth/userinfo.email&quot;
    ],
  </code></pre>
  <p>but this had no effect.</p>