Hi Simon, AFAIK, OAuth doesn't present a Captcha challenge, ClientLogin API does. Sounds like a misconfiguration to me. OAuth 1.0a access tokens don't expire, so you need to get the user to enter the credentials once to generate an accessToken, save it, and then keep reusing it for future requests. The other option is to link the client account under your MCC, and use your credentials to generate AuthTokens. That way, you won't have to ask for your client's credentials at all, but the linking process is manual.
Could you provide some more details of your application? E.g. is it a web application? Cheers, Anash P. Oommen, AdWords API Advisor. On Thursday, 29 March 2012 16:31:31 UTC+5:30, baynezy wrote: > > Anash, > Thanks very much for your help on this. I think I have gone down the > wrong path here. The OAuth version of the API presents me with a > CAPTCH challenge that I need to forward to the user. However, I am not > creating a client application for users to manage their AdWords > accounts where this process makes perfect sense as I would not want to > store their account credentials. However, I am building an integration > with my application so I can programmatically create campaigns, > adgroups, etc. and this CAPTCHA challenge makes this not feasible as > this will not be in response to a user action but an automated > process. Is there a way to interact with the API where I can use my > credentials that I know, without having to deal with manually > authenticating? > > Thanks again. > > Simon Baynes > > On Thursday, March 29, 2012 10:04:12 AM UTC+1, Anash P. Oommen wrote: >> >> Hi Simon, >> >> There are couple more pieces to getting OAuth to work on an ASP.NETwebsite. >> >> 1. There's some initialization code that should go in your Global.asax. >> : >> http://code.google.com/p/google-api-adwords-dotnet/source/browse/trunk/examples/adwords/csharp/oauth/Global.asax.cs >> >> 2. There should be some mechanism to trigger the OAuth signup, as shown >> here: >> >> http://code.google.com/p/google-api-adwords-dotnet/source/browse/trunk/examples/adwords/csharp/oauth/GetAllCampaigns.aspx.cs#58 >> >> >> Hope this helps: Let me know if you have more questions. >> >> Cheers, >> Anash P. Oommen, >> AdWords API Advisor. >> >> On Wednesday, 28 March 2012 20:09:13 UTC+5:30, baynezy wrote: >>> >>> I am trying (with not much luck) to access the Google AdWords API using >>> the .Net Client >>> Library<http://code.google.com/p/google-api-adwords-dotnet/>to access their >>> SandBox <http://code.google.com/apis/adwords/docs/sandbox.html> API. >>> >>> Here is my code:- >>> >>> >>> // create campaign >>> var campaign = new Campaign >>> { >>> name = "Simon's Campaign", >>> status = CampaignStatus.ACTIVE, >>> servingStatus = ServingStatus.SERVING, >>> budget = new Budget >>> { >>> period = >>> BudgetBudgetPeriod.DAILY, >>> amount = new Money >>> { >>> >>> microAmount = 100000 >>> }, >>> deliveryMethod = >>> BudgetBudgetDeliveryMethod.STANDARD >>> }, >>> adServingOptimizationStatus = >>> AdServingOptimizationStatus.OPTIMIZE, >>> frequencyCap = new FrequencyCap >>> { >>> impressions = >>> 100000, >>> timeUnit = >>> TimeUnit.MINUTE, >>> level = >>> Level.CAMPAIGN >>> } >>> }; >>> var operation = new CampaignOperation {@operator = >>> Operator.ADD, operand = campaign}; >>> var operations = new CampaignOperation[1]; >>> operations[0] = operation; >>> >>> >>> // get service >>> var user = new AdWordsUser(); >>> var url = Request.Url.GetLeftPart(UriPartial.Path); >>> var config = user.Config as AdWordsAppConfig; >>> user.OAuthProvider = new AdsOAuthNetProvider( >>> config.OAuthConsumerKey, >>> config.OAuthConsumerSecret, >>> AdWordsService.GetOAuthScope(user.Config as >>> AdWordsAppConfig), >>> url, >>> Session.SessionID >>> ); >>> >>> var service = (CampaignService) >>> user.GetService(AdWordsService.v201109.CampaignService); >>> var page = service.mutate(operations); >>> >>> When I run this I get an `AdWordsApiException` with an InnerException >>> `AuthenticationError.OAUTH_TOKEN_HEADER_INVALID @ >>> Service[CampaignService.mutate]` >>> >>> Now I have the following in my `Web.config`:- >>> >>> <!-- Note: For testing purposes, you can use the OAuth consumer >>> key/secret as anonymous/anonymous.--> >>> <add key="AuthorizationMethod" value="OAuth"/> >>> <add key="OAuthConsumerKey" value="anonymous"/> >>> <add key="OAuthConsumerSecret" value="anonymous"/> >>> <!-- Uncomment this key if you want to use v13 sandbox. --> >>> <!-- <add key="LegacyAdWordsApi.Server" value=" >>> https://sandbox.google.com"/> --> >>> <!-- Uncomment this key if you want to use AdWords API sandbox. --> >>> <add key="AdWordsApi.Server" value=" >>> https://adwords-sandbox.google.com"/> >>> >>> As I understand it this is set up correctly, what am I missing? >>> >>> Any help would be very gratefully received!!! >>> >> -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and discussion group: http://adwordsapi.blogspot.com http://groups.google.com/group/adwords-api =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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
