Exemplo n.º 1
0
 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()
         });
     }
 }
Exemplo n.º 2
0
        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()
                });
            }
        }