OfflineConversionError UNAUTHORIZED_USER - google-ads-api

I am working on a Google AdWords integration built on .NET, which was developed some time ago for API v201409. That version of the API has not been retired and I am now trying to migrate to the latest (v201506).
I have updated the Nuget package and it builds fine.
The account that I use to upload conversions is a manager account, with around 50 client accounts being managed by it.
When trying to upload conversions to some of the client accounts I am getting OfflineConversionError.UNAUTHORIZED_USER errors.
When I check the setup on the Google AdWords website everything looks fine. Each client account has the manager account set in the Account access settings.
I have used the ManagedCustomerService API to retrieve a list of client accounts that are managed by the manager account and it returns all accounts, including those that throw the error.
All refresh/access tokens appear to be working fine.
Has anyone experienced similar problems?

The OfflineConversionError.UNAUTHORIZED_USER is returned when you attempt to upload conversion data to an Adwords account other than the account that the click originated from.
If you have a manager account with multiple client accounts, make sure that the account ID is the correct one.

Related

Setting up oAuth with the Google AdWords API

I am attempting to get get a Ruby on Rails project that uses the Google AdWords API.
What I did so far, following the steps in this guide:
I created an AdWords Manager account.
I created a test account that is part of the AdWords Manager account.
I set up the Ruby client library in my Rails project.
I then attempted to set up OAuth2 authentication with the example code from the guide.
However since the guide was written (and the video version of the guide was made) it seems that the interface has changed. I am able to create a Client ID client_secrets.json-file, or a Service Account .json file. I am able to export these and read the settings from .
I added the required settings, using an OAUTH2_SERVICE_ACCOUNT .json file.
Now, when attempting to connect, I get back the AdwordsAPIException AuthenticationError.NOT_ADS_USER.
I therefore know that the actual authentication works. However, the authorization does not.
How can I turn on AdWords API support for the oAuth credentials from my google accounts? The Google Credentials Console lists many APIs that you can turn on, but the AdWords API is not in there. The AdWords guide does not mention turning on an API at all, and only tells you to create a new Credential.
What is going on here?
The Adwords API does not need to be added to your project in the Google Cloud console (it's always enabled)—as indicated by the error message, the actual problem lies in the fact that your service account does not have access to any Adwords accounts.
As a matter of fact, the only way to use service accounts to authenticate against the Adwords API is when you're also using a G Suite domain (see the corresponding documentation, section "Prerequisites".
If you have a G Suite domain, you'll need to
Enable "G Suite Domain-wide Delegation" on your service account key
Add the project ID of the Google cloud project to your G Suite domain's authorized API client list
Use your service account to impersonate any user from your G suite domain that has Adwords access
As you can see, it's quite an involved process. My recommendation (that is shared by the above article) is to use an OAuth2 installed application flow for any user that has Adwords access. This requires to store the obtained refresh token on your end, but is more flexible (and arguably safer) than a delegation-enabled service account and easier to set up.

SurveyMonkey API v2 returns "Client revoked access grant"

Using v2 to get the survey list (https://api.surveymonkey.net/v2/surveys/get_survey_list) and receiving the error message "Client revoked access grant." Had just used the same script with the same access key and api key less than 2 months ago without incident. Have done nothing with the API in the account since, so not understanding why this is not working. This is on a Gold level account.
I know that it is close to the end of support date on v2 of the API, but my understanding is that date is December 1, 2016. Besides, I have another account in which I can run the same script (a Premium account with different key values, of course) and it is working for that account.
Yes this is more of a SurveyMonkey support question. There was a widespread issue where people using an invalid access token (generated with the API Console app, not their own app) stopped working.
You can just go to the SurveyMonkey developer portal and find your app. There will be an access token in the settings page. If your app isn't there, contact support to have it connected to your account.

How to implement "Use one-click single sign-on" correctly in order to publish to Google Apps Marketplace

We already have a web app that integrate with differente Google services. Right now, you can loguin using a Google account, can import a contact lists from any Google account, and can sync a Google Calendar with our Calendar in the webapp (We implemented all of this using OAuth 2 and invoking the GoogleApi with a REST Client).
We are now trying to publish this app in the GoogleApp Marketplace, but we are failing to comply with the "Use one-click single sign-on" rule (https://developers.google.com/apps-marketplace/practices#5_use_one-click_single_sign-on).
We are believing that the problem is we the way we are solving the fact that we need offline access for all the integrated users in the app. Right now, the only way we found to get the refresh tokens for them, was starting the OAuth2 process with the parameters access_type=offline&approval_prompt=force, but this forces them to enter their credentials.
We aren't using the 'Google+ Domains API', and we are starting to believe that we should. Is the use of this API mandatory for complying with the "Use one-click single sign-on" rule?
Thanks,
Well, we finally figured it out. We had to use the Google Admin SDK in order to implement SSO. We had some troubles with the scopes, but after we polished that, everything seems to be working OK.

Ruby Google API key and analytics

I am creating a Ruby application that needs to access dozens (maybe hundreds) of different Google Analytics accounts, query each account, and then generate a report based on the results. I know I can achieve this using Googles API client ( http://code.google.com/p/google-api-ruby-client/ ) and Oauth, but that would require manually generating a set of keys and credentials for each analytics account which is not really feasible. I'm wondering if there is another way to access google analytics (perhaps using the API Keys?) that bypasses the need to generate credentials manually.
After quite a bit of tinkering, I've finally stumbled upon a solution to my particular problem. As it turns out, I don't need to create a separate Developer account for each Analytics account I want to access. I can simply create a single Developer account, and then add that Developer accounts' email address to the set of users that are able to access the Analytics account. This will allow me to access multiple Analytics accounts using the same Developer account.
Yes, it will still require quite a bit of work adding the Developer email account to hundreds of Google Analytics accounts, but it pales in comparison to creating a separate set of Developer credentials for each Analytics account.

Google AdWords API - Report Definition Issue

We are upgrading from the 201109 API to the 201209 one. The 201109 one could run a report and get data back for any client under an Adwords Account (MMC included).
Now, I get an error of "CUSTOMER_SERVING_TYPE_REPORT_MISMATCH" with version 201209. https://developers.google.com/adwords/api/docs/troubleshooting?hl=en#ReportDefinitionError.CUSTOMER_SERVING_TYPE_REPORT_MISMATCH
Can anyone shed light as to why you can no longer generate a report (and how to fix) using ReportDefinitionService for clients under an MMC account?
Even I got the same error when the client-customer-id was set to the MCC Id, but when I changed it to the client Id of a particular Adwords account, this error did not occur.
I think you cannot generate a report across all client accounts in an MCC(if you are trying to do this). You will have to generate separate reports for each client account.
Hope this helps :D
You could download a list of account IDs from the account hierarchy report then run your reports over each account ID. Unfortunately querying the MCC no longer works

Resources