title: Using google speech API in C# returns 403 error
body: <p>Trying to use Google Speech API in C# returns 403.</p>
  
  <p>In Google Cloud Platform I generated a key and still getting the 403 error.</p>
  
  <p>Used this code:</p>
  
  <pre><code>class Program
   {
      static void Main(string[] args)
      {
          try
          {
  
              FileStream fileStream = File.OpenRead("good-morning-google.flac");
              MemoryStream memoryStream = new MemoryStream();
              memoryStream.SetLength(fileStream.Length);
              fileStream.Read(memoryStream.GetBuffer(), 0, (int)fileStream.Length);
              byte[] BA_AudioFile = memoryStream.GetBuffer();
              HttpWebRequest _HWR_SpeechToText = null;
              _HWR_SpeechToText =
                          (HttpWebRequest)HttpWebRequest.Create(
                              "https://www.google.com/speech-api/v2/recognize?output=json&amp;lang=en-us&amp;key=YOUR_API_KEY_HERE");
              _HWR_SpeechToText.Credentials = CredentialCache.DefaultCredentials;
              _HWR_SpeechToText.Method = "POST";
              _HWR_SpeechToText.ContentType = "audio/x-flac; rate=44100";
              _HWR_SpeechToText.ContentLength = BA_AudioFile.Length;
              Stream stream = _HWR_SpeechToText.GetRequestStream();
              stream.Write(BA_AudioFile, 0, BA_AudioFile.Length);
              stream.Close();
  
              HttpWebResponse HWR_Response = (HttpWebResponse)_HWR_SpeechToText.GetResponse();
              if (HWR_Response.StatusCode == HttpStatusCode.OK)
              {
                  StreamReader SR_Response = new StreamReader(HWR_Response.GetResponseStream());
                  Console.WriteLine(SR_Response.ReadToEnd());
              }
  
          }
          catch (Exception ex)
          {
              Console.WriteLine(ex.ToString());
          }
  
          Console.ReadLine();
      }
  }
  </code></pre>
  
  <p>It's probably some invalid key issue,tried generating server key and browser key, same result, 403 (forbidden)</p>
  
  <p>please help.</p>