Hi Pravin,
What is the error you get when you hit the line of code you highlighted?
Thanks,
Josh, AdWords API Team
On Tuesday, May 12, 2015 at 3:09:17 AM UTC-4, Pravin Yadav wrote:
>
> Hi,
> Yes i had used access_type=offline like below
>
> HttpContext.Current.Response.Redirect("
> https://accounts.google.com/o/oauth2/auth?scope=https%3a%2f%2fwww.googleapis.com%2fauth%2fadwords&state=callback&redirect_uri=http%3a%2f%2flocalhost%3a1366%2fOAuthLogin.aspx&response_type=code&client_id=4516991244-33c20b7an0j8m1e1gtin9mr2l9vc46vr.apps.googleusercontent.com&access_type=offline
> ");
>
> even that it was not connect.
>
> So any mistake of my code or any other way then please let me know.
>
> *My Service Code please Check it and tell about changes..*
>
>
> [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("
> https://accounts.google.com/o/oauth2/auth?
> scope=https%3a%2f%2fwww.googleapis.com
> %2fauth%2fadwords&state=callback&redirect_uri=http%3a%2f%2flocalhost%3a1366%2fOAuthLogin.aspx&response_type=code&client_id=
> 4516991244-33c20b7an0j8m1e1gtin9mr2l9vc46vr.apps.googleusercontent.com
> &access_type=offline");
>
> //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();
> ..............
> .............
> ............My Get Campaign Code
> .............
> }
> return datatable;
>
>
>
> *Consuming Service*
>
> localhost.MaiaAdWordsService service = new localhost.MaiaAdWordsService();
>
> DataTable dt = new DataTable();
>
> dt = service.AuthonticationConfig();//Getting Error at
> here..................
> Gdv_TestService.DataSource = dt;
>
> Please suggest solution.
>
>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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].
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/a1ba16a8-ee4d-4dec-a328-a96dc4eabe1b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.