Hi Pravin, I think the problem is with the way you designed your service. ASMX page (or rather a WebMethod) is the wrong place to send the user through a redirect. I'm assuming that you'd need to authenticate the user AND have a web service that you can call from other applications. If yes,
- You should build a web frontend (aspx) that authenticates the user, and obtain the refresh token. Pretty much the logic in https://github.com/googleads/googleads-dotnet-lib/tree/master/examples/AdWords/CSharp/OAuth, except that Default.aspx.cs doesn't call any AdWords APi services; it simply saves the access and refresh tokens into a database. - You should build a web service (asmx) that reads the refresh and access tokens from the database, construct an AdWordsUser and make an API call. https://github.com/googleads/googleads-dotnet-lib/blob/master/examples/AdWords/CSharp/OAuth/OAuthLogin.aspx.cs#L80 has some comments on how to reconstruct a credentials object from scratch. - You should set RetryCount <https://github.com/googleads/googleads-dotnet-lib/blob/master/examples/AdWords/CSharp/OAuth/Web.config#L30> in your asmx service's web.config so that it will fetch a new access token using the refresh token in case the access token has expired. If this fails, the asmx service should throw an exception (and probably put a flag in the database) so that the UI can then ask the user to reauthorize your application the next time they visit your site. Hope this helps. Let me know if you have more questions, Cheers, Anash P. Oommen, AdWords API Advisor. On Wednesday, May 13, 2015 at 1:17:19 AM UTC-4, Pravin Yadav wrote: > > > > On Wednesday, May 13, 2015 at 10:35:45 AM UTC+5:30, Pravin Yadav wrote: >> >> >> Hi.. >>>> >>>> In detail about errors. > > >> *When i >>>> using HttpContext.Current.Response.Redirect(oAuth.GetAuthorizationUrl()); >>>> >>>> //access_type is not offline that time getting following error at same >>>> line* >>>> >>>> *Consuming Service* >>>> >>>> localhost.MaiaAdWordsService service = new >>>> localhost.MaiaAdWordsService(); >>>> >>>> DataTable dt = new DataTable(); >>>> >>>> dt = service.AuthonticationConfig();//Getting Error at >>>> here.................. >>>> Gdv_TestService.DataSource = dt; >>>> >>>> Getting following error at highlighted line.. >>>> >>> >> >> >> >> >> *The request failed with the error message:--<html><head><title>Object >> moved</title></head><body><h2>Object moved to <a >> href="https://accounts.google.com/o/oauth2/auth?scope=https%3a%2f%2fwww.googleapis.com%2fauth%2fadwords&state=callback&redirect_uri=http%3a%2f%2flocalhost%3a25232%2fMaiaAdWordsService.asmx&response_type=code&client_id=4516991244-33c20b7an0j8m1e1gtin9mr2l9vc46vr.apps.googleusercontent.com&access_type=offline >> >> <https://accounts.google.com/o/oauth2/auth?scope=https%3a%2f%2fwww.googleapis.com%2fauth%2fadwords&state=callback&redirect_uri=http%3a%2f%2flocalhost%3a25232%2fMaiaAdWordsService.asmx&response_type=code&client_id=4516991244-33c20b7an0j8m1e1gtin9mr2l9vc46vr.apps.googleusercontent.com&access_type=offline>">here</a>.</h2></body></html>* >> >> *I cant open permission page and accept Permissions at the time of >> service consuming.* >> > > *And When i using access_type offline i.e.* > 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"); > > that time below error at same line > >> >> >>> Unable to connect to the remote server" >>>> >>> -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com 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 adwords-api+unsubscr...@googlegroups.com. 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/0718ab50-7052-4838-9bf0-dff4be07833d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.