even that it was not connect.
So any mistake of my code or any other way then please let me know.
[WebMethod(EnableSession = true, Description = "Authontication & Get Data From AdWords")]
public DataTable AuthonticationConfig()
{
{
DataTable cdataTable = new DataTable();
AdWordsUser user = new AdWordsUser();
(user.Config as AdWordsAppConfig).ClientCustomerId = "xx3-xxx-xxxx";
//auth_token = AdWords::AuthToken.get_token(Email,Password,'
www.google.com', 443, true);
AdWordsAppConfig config = new AdWordsAppConfig();
if (config.OAuth2Mode == OAuth2Flow.APPLICATION &&
string.IsNullOrEmpty(config.OAuth2RefreshToken))
{
config.OAuth2RedirectUri = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Path);
OAuth2ProviderForApplications oAuth = new OAuth2ProviderForApplications(config);
if (HttpContext.Current.Request.Params["state"] == null)
{
oAuth.State = "callback";
//HttpContext.Current.Response.Redirect(oAuth.GetAuthorizationUrl());
}
else if (HttpContext.Current.Request.Params["state"] == "callback")
{
oAuth.FetchAccessAndRefreshTokens(HttpContext.Current.Request.Params["code"]);
Session["OAuthProvider"] = oAuth;
}
// return HttpContext.Current.Session["OAuthProvider"];
AdWordsAppConfig config1 = (user.Config as AdWordsAppConfig);
if (config1.OAuth2Mode == OAuth2Flow.APPLICATION &&
string.IsNullOrEmpty(config1.OAuth2RefreshToken))
{
user.OAuthProvider = (OAuth2ProviderForApplications)Session["OAuthProvider"];
}
string txtCustomerId = "955-757-3583";
string getIndex = "Campaign";
if (Session["OAuthProvider"] != null)
{
Session["AdwordsData"] = null;
#region Campaign
Selector selector = new Selector();
..............
.............
.............
localhost.MaiaAdWordsService service = new localhost.MaiaAdWordsService();
DataTable dt = new DataTable();
dt = service.AuthonticationConfig();//Getting Error at here..................
Gdv_TestService.DataSource = dt;
Please suggest solution.