title: 403 forbidden exception in accessing access token
body: <p>I am trying to generate a new access token when access token from Google is expired. But On my production server i am getting below mentioned exception:</p>
  
  <pre><code>Exception:
  at System.Net.HttpWebRequest.GetResponse() at System.Net.HttpWebRequest.GetResponse() at     
  GoogleCalendarProvider_V3.ExchangeCodeWithAccessAndRefreshToken(String RefreshToken)
  
  Exception Message:
  The remote server returned an error: (403) Forbidden.
  </code></pre>
  
  <p>I am creating a http web request in order to get the access token. please check the below code for this</p>
  
  <pre><code>string Url = "https://accounts.google.com/o/oauth2/token";
      string grant_type = "refresh_token";
      string data = "client_id={0}&amp;client_secret={1}&amp;refresh_token={2}&amp;grant_type={3}";
  
          HttpWebRequest request = HttpWebRequest.Create(Url) as HttpWebRequest;
          string result = string.Empty;
          request.Method = "POST";           
          request.KeepAlive = true;
          request.ContentType = "application/x-www-form-urlencoded";                    
          string param = string.Format(data, ClientID, ClientSecret, RefreshToken, grant_type);
          request.Credentials = CredentialCache.DefaultCredentials;
          var bs = Encoding.UTF8.GetBytes(param);
          using (Stream reqStream = request.GetRequestStream())
          {
              reqStream.Write(bs, 0, bs.Length);
          }
          using (WebResponse response = request.GetResponse())
          {
              var sr = new StreamReader(response.GetResponseStream());
              result = sr.ReadToEnd();
              sr.Close();
          }
  </code></pre>
  
  <p>please help me in this context.</p>