Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

webservice renew Token

Status
Not open for further replies.

csupriest

Programmer
Joined
Jan 25, 2006
Messages
5
Location
US
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();

}


}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top