示例#1
0
 public void dropToken()
 {
     token = null;
     auth = false;
 }
示例#2
-2
 public bool authorize(String authCode)
 {
     // get the access token
     HttpClient http = new HttpClient(baseUri);
     HttpUrlEncodedForm req = new HttpUrlEncodedForm();
     req.Add("code", authCode);
     req.Add("client_secret", client_secret);
     req.Add("client_id", client_id);
     HttpResponseMessage resp = http.Post("access_token", req.CreateHttpContent());
     if (resp.StatusCode == System.Net.HttpStatusCode.OK)
     {
         token = resp.Content.ReadAsJsonDataContract<AccessToken>();
         auth = true;
         return true;
     }
     auth = false;
     return false;
 }