title: Google OAuth-orization without a browser
body: <pre><code>using (var stream =
                  new FileStream("client_secret.json", FileMode.Open, FileAccess.Read))
              {
                  string credPath = System.Environment.GetFolderPath(
                      System.Environment.SpecialFolder.Personal);
                  credPath = Path.Combine(credPath, ".credentials/drive-dotnet-quickstart.json");
  
                  credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                      GoogleClientSecrets.Load(stream).Secrets,
                      Scopes,
                      "user",
                      CancellationToken.None,
                      new FileDataStore(credPath, true)).Result;
                  Console.WriteLine("Credential file saved to: " + credPath);
              }
  </code></pre>
  
  <p>This piece of code from <a href="https://developers.google.com/drive/v3/web/quickstart/dotnet#further_reading" rel="nofollow noreferrer">here</a> handles the authentication of an application and saves a user credential file.</p>
  
  <p>But, it does so using a browser. I read, somewhere, that google no longer supports the checking of raw username &amp; passwords, and instead have the user login via the browser.</p>
  
  <p>Can I not embed a browser in my C# application, and have the authentication done in here, instead of annoyingly opening a browser?</p>