Hi,
Thanks for the link, it's very helpful.
So I wrote another post method to get a renew token, however I am getting
error "(400) Bad Request.".
is it because the application I defined as a "web application" (I got my
first accesstoken from the call back link) not "Installed Application" ?
public GoogleAccessTokenData
GetAccessTokenDataFromRefreshToken(string authorizationCode, string
refreshToken)
{
string Url = "https://accounts.google.com/o/oauth2/token";
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-www-form-urlencoded";
string param = string.Format(data, authorizationCode,
_GoogleClientId, _GoogleSecret, refreshToken);
var bs = Encoding.UTF8.GetBytes(param);
* using (Stream reqStream = request.GetRequestStream()) <===
exception thrown with error "(400) Bad Request**"*
{
reqStream.Write(bs, 0, bs.Length);
}
using (WebResponse response = request.GetResponse())
{
var sr = new StreamReader(response.GetResponseStream());
result = sr.ReadToEnd();
sr.Close();
}
var jsonSerializer = new JavaScriptSerializer();
var tokenData =
jsonSerializer.Deserialize<GoogleAccessTokenData>(result);
return tokenData;
}
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.