public bool login(string accout, string passwd) { try { if (token != null) { http.Request.AddExtraHeader("Authorization", token); return(true); } else { dynamic customer = new { account = accout, password = MD5.CalcString(passwd) }; // Or any dynamic type HttpResponse a = http.Post(url + APIConst.GetToken, customer, HttpContentTypes.ApplicationJson); var dd = a.DynamicBody; if (!string.IsNullOrEmpty(dd.token)) { token = "bearer " + dd.token; http.Request.AddExtraHeader("Authorization", token); return(true); } return(false); } } catch (Exception e) { return(false); } }