title: Google Drive Api get current user
body: <p>I'm following the Google Drive Api documentation that is at:
  <a href="https://developers.google.com/drive/v3/web/quickstart/dotnet" rel="nofollow noreferrer">https://developers.google.com/drive/v3/web/quickstart/dotnet</a></p>
  <p>I've changed the folder to another specific folder.</p>
  <h3>My Code</h3>
  <pre><code>string credPath = Server.MapPath(@&quot;~\googleDrive&quot;);
  credPath = Path.Combine(credPath, &quot;.credentials/drive-dotnet-quickstart.json&quot;);
  
  credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
      GoogleClientSecrets.Load(stream).Secrets,
      Scopes,
      &quot;user&quot;,
      CancellationToken.None,
      new FileDataStore(credPath, true)).Result;  
  </code></pre>
  <p>By the implemented form, the same permission will always be used (the first one), since it must be linked to the 'user' field.</p>
  <h3>My questions:</h3>
  <ol>
  <li>How do I search for the current account logged into Google to put it in the <code>user</code> field?</li>
  <li>How do I if the user is not logged in, he can not access anything?</li>
  <li>Should I change the <code>user</code> field or the license path or both, for user<code> x</code> not accessing user data <code>y</code>?</li>
  <li>If on the permission screen as the image below, if the user close the browser or deny access, what is the best practice for the page not to be locked?</li>
  </ol>
  <p><a href="https://i.stack.imgur.com/XuCDR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XuCDR.png" alt="enter image description here" /></a></p>