title: How can I hardcode the authentication and authorization part of google drive api?
body: <p>Currently I have codes which the user authorize before they can access the files inside their own Google Drives account using <strong>OAuth2</strong> however now I want to hardcode the authentication part and authorization part into the source code for the <strong>aspx.cs page</strong>. </p>
  
  <p>Is it possible? The language I currently am using right now is in <strong>ASPx</strong> together with <strong>C#</strong>. I used this <code>using ASPSnippets.GoogleAPI;</code> for the codes below.</p>
  
  <p>Here are the codes for my 0Auth2 using client secret and client id</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      GoogleConnect.ClientId = "client_id";
      GoogleConnect.ClientSecret = "client_secret";
      GoogleConnect.RedirectUri = Request.Url.AbsoluteUri.Split('?')[0];
      GoogleConnect.API = EnumAPI.Drive;
      if (!string.IsNullOrEmpty(Request.QueryString["code"]))
      {
          string code = Request.QueryString["code"];
          string json = GoogleConnect.Fetch("me", code);
          GoogleDriveFiles files = new JavaScriptSerializer().Deserialize&lt;GoogleDriveFiles&gt;(json);
  
          //Remove the deleted files.
          dlFiles.DataSource = files.Items.Where(i =&gt; i.Labels.Trashed == false);
          dlFiles.DataBind();
      }
      else if (Request.QueryString["error"] == "access_denied")
      {
          ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "alert('Access denied.')", true);
      }
      else
      {
          GoogleConnect.Authorize("https://www.googleapis.com/auth/drive.readonly");
      }
  }
  </code></pre>