Hi, Just sharing my experience with OAuth2 service account.
Step 1: Create 'Service Account' in 'API console' - Log in to api console using the email that you used to connect adwords api. The email should be from your domain, for example, adwo...@yourdomain.com https://code.google.com/apis/console/ - Create a new project if you havn't done so in the past. - Go to 'API Access' page and 'Create client ID', choose 'Service Account' from the options. - Download private key of the client service account, take note of 'Client ID' and 'Email address'. You'll see something like; Client ID : 123456789012.apps.googleusercontent.com Email address : 123456789...@developer.gserviceaccount.com Public key fingerprints : 123456789abcdef123456789abcdef123456789a Private key's default filename is like '123456789abcdef123456789abcdef123456789a-privatekey.p12' Step 2: Authorize api client in 'Google Apps for Business' - You need domain administrator access to 'Google Apps for Business'. Log in to http://www.google.com/enterprise/apps/business/ with domain admin account. - Go to 'Advanced Tools > Manage client API access'. - Enter client ID, from above example that's '123456789012.apps.googleusercontent.com' in 'Client Name' field. - Enter 'https://adwords.google.com/api/adwords' in 'One or More API Scopes' field. - Hit 'Authorize' Here's the page to detail instructions OAuth: Managing API client access http://support.google.com/a/bin/answer.py?hl=en&answer=162106 Step 3: Coding using java client libraries - I use 'Google API Client Library for Java, version 1.11.0-beta' https://code.google.com/p/google-api-java-client/downloads/detail?name=google-api-java-client-1.11.0-beta.zip&can=2&q= - And follow the OAuth2 example from https://code.google.com/p/google-api-ads-java/source/browse/examples/adwords_axis/src/main/java/adwords/axis/v201209/misc/OAuth2Example.java But replace getOAuth2Credential() with private static Credential getOAuth2Credential() throws Exception { File keyFile = new File("123456789abcdef123456789abcdef123456789a-privatekey.p12"); GoogleCredential serviceAccountCredential = new GoogleCredential.Builder() .setTransport(new NetHttpTransport()) .setJsonFactory(new JacksonFactory()) .setServiceAccountId("123456789...@developer.gserviceaccount.com") .setServiceAccountScopes("https://adwords.google.com/api/adwords") .setServiceAccountPrivateKeyFromP12File(keyFile) .setServiceAccountUser("adwo...@yourdomain.com") .build(); return serviceAccountCredential; } You can ignore CALLBACK_URL, CLIENT_ID and CLIENT_SECRET. They are use for interactive web server application. Check 'ads.properties' file api.adwords.email=adwo...@yourdomain.com api.adwords.password=******* api.adwords.clientCustomerId.prod=123-456-7890 api.adwords.environment=production That's it and good luck. Win Ko On Wednesday, October 17, 2012 1:19:55 AM UTC+8, Bobby wrote: > > Specifically, I am trying to run AdHoc reports without any user > interaction. Since it is a new application, it would be desirable to use > the latest technology instead of using something that is already deprecated > (i.e. ClientLogin). Can one of the AdWords moderators please comment? If > this is not possible, please provide an alternate solution that will not > require updating in the near future. Thanks. -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 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