private void GetFeatures(AuthResponse access) { string jsonFusion = String.Format("https://www.googleapis.com/fusiontables/v2/query?sql=SELECT * FROM {0}&access_token={1}", strTableID, access.Access_token); try { WebClient client = new WebClient(); string result = client.DownloadString(jsonFusion); FusionTable ft = JsonConvert.DeserializeObject<FusionTable>(result); Plot(ft); this.Close(); } catch (Exception ex) { } }
private void GetFeatures(AuthResponse access) { string jsonFusion = String.Format("https://www.googleapis.com/fusiontables/v2/query?sql=SELECT * FROM {0}&access_token={1}", strTableID, access.Access_token); try { WebClient client = new WebClient(); string result = client.DownloadString(jsonFusion); FusionTable ft = JsonConvert.DeserializeObject <FusionTable>(result); Plot(ft); this.Close(); } catch (Exception ex) { } }
public void refresh() { var request = (HttpWebRequest)WebRequest.Create("https://accounts.google.com/o/oauth2/token"); string postData = string.Format("client_id={0}&client_secret={1}&refresh_token={2}&grant_type=refresh_token", this.clientId, this.secret, this.refresh_token); var data = Encoding.ASCII.GetBytes(postData); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = data.Length; using (var stream = request.GetRequestStream()) { stream.Write(data, 0, data.Length); } var response = (HttpWebResponse)request.GetResponse(); var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd(); var refreshResponse = AuthResponse.get(responseString); this.access_token = refreshResponse.access_token; this.created = DateTime.Now; }
private void formAuthorize_Load(object sender, EventArgs e) { webBrowser1.Navigate(AuthResponse.GetAutenticationURI(scope, clientId, redirectURI)); }