public async Task <VO.Autho> getAuth(string code) { var values = new Dictionary <string, string> { { "access_token", "326527821977671|2b594617951c9b59727c2bd57735280c" }, { "code", code } }; var content = new FormUrlEncodedContent(values); var response = await client.PostAsync("https://graph.facebook.com/v2.6/device/login_status", content).ConfigureAwait(false); var responseString = await response.Content.ReadAsStringAsync().ConfigureAwait(false); VO.Autho autho = JsonConvert.DeserializeObject <VO.Autho>(responseString); return(autho); }
private async void timer1_Tick(object sender, EventArgs e) { this.autho = await facebookLogin.getAuth(this.code.code); //Console.WriteLine(autho.access_token); if (autho.access_token != null) { timer1.Stop(); timer1.Enabled = false; this.facebookUser = await facebookLogin.getUser(autho.access_token); session = new VO.Session(facebookUser.name, facebookUser.email); Console.WriteLine(session.Nombre + " " + session.Email); openMainForm(new Aplication()); } }