How do I renew a token. I want to use HttpWebrequest. Here is what I have so far
public override void PreExecute()
{
string Url = "
string data = "code={0}&client_id={1}&client_secret={2}&refresh_token={3}&grant_type=refresh_token";
HttpWebRequest request = HttpWebRequest.Create(Url) as HttpWebRequest;
string result = null;
request.Method = "POST";
request.KeepAlive = true;
request.ContentType = "application/x-
string param = string.Format(data, "" , "");
var bs = Encoding.UTF8.GetBytes(param);
using (Stream reqStream = request.GetRequestStream())
{
reqStream.Write(bs, 0, bs.Length);
}
using (WebResponse response = request.GetResponse())
{
var sr = new StreamReader(response.GetResponseStream());
result = sr.ReadToEnd();
sr.Close();
}
}
public override void PreExecute()
{
string Url = "
string data = "code={0}&client_id={1}&client_secret={2}&refresh_token={3}&grant_type=refresh_token";
HttpWebRequest request = HttpWebRequest.Create(Url) as HttpWebRequest;
string result = null;
request.Method = "POST";
request.KeepAlive = true;
request.ContentType = "application/x-
string param = string.Format(data, "" , "");
var bs = Encoding.UTF8.GetBytes(param);
using (Stream reqStream = request.GetRequestStream())
{
reqStream.Write(bs, 0, bs.Length);
}
using (WebResponse response = request.GetResponse())
{
var sr = new StreamReader(response.GetResponseStream());
result = sr.ReadToEnd();
sr.Close();
}
}