public Token TradeAuthForToken(string authCode) { try { WebClient wc = new WebClient(); JsonStatus ret = JsonConvert.DeserializeObject <JsonStatus>(wc.DownloadString(SpoffyEndpoint + "Auth?authCode=" + authCode)); if (ret.status == "200") { return(JsonConvert.DeserializeObject <Token>(ret.data.ToString())); } return(new Token() { Error = ret.data.ToString() }); } catch (Exception ex) { return(new Token() { Error = ex.ToString() }); } }
public Token RefreshToken(string refresh) { try { WebClient wc = new WebClient(); JsonStatus ret = JsonConvert.DeserializeObject <JsonStatus>(wc.DownloadString(SpoffyEndpoint + "Refresh?token=" + refresh)); if (ret.status == "200") { return(JsonConvert.DeserializeObject <Token>(ret.data.ToString())); } return(new Token() { Error = ret.data.ToString() }); } catch (Exception ex) { return(new Token() { Error = ex.ToString() }); } }