Anyone has experience connecting Google Ads?

I've been figuring out how to connect EasyMorph with Google Ads.
So far, I have created a Service Account and a OAuth Access on Google Cloud and I'm ready to access the API. But I can't make EasyMorph to connect. I'm sure I'm missing something.

With a Service Account:

I have created a new connector that looks like this.

And the setup looks like this
image

The parameters like this!

And finally, I run a test...
image

But always got a 401.
image

The Service account has access. I also tried with OAuth... same story.
Can't have detailed http answer for debugging...
What I'm missing? anyone had done the same?

Hi @Daniel_Gonzalez

Firstly, it seems that you may have forgotten to press the large "Authorize" button in the connector window after setting it up. With OAuth, it is necessary to complete an interactive authorization in order for EasyMorph to obtain the access token before utilizing the connector.

Secondly, it appears that you have entered the wrong Base URL. The Base URL should be the URL for the API to which you will be making requests, rather than the URL for OAuth services like on your screenshot.
For Google Ads, the Base URL should be something like https://googleads.googleapis.com/v14.

Thirdly, please make sure to enter both your client ID and client secret, as both are required. Additionally, I am unsure about all the parameters you have entered - are you certain that they are all required (such as private key, etc)? According to the Google Ads API documentation, I couldn't find any reference to them.

Furthermore, please note that in order to access Google Ads, you may additionally need to apply for a developer token. You can find more information on how to obtain a developer token at the following link: Obtain a developer token  |  Google Ads API  |  Google for Developers

Lastly, there is a sample Google WebAPI project available that includes a pre-setup connector for the Google API. You can repurpose this connector by simply changing the Base URL to Google Ads API and entering your credentials (client ID and secret).

You can find the project at the following link: How to import data from Google Search Console

Thanks for your answer!
Well, I didn't forget to apply the Client secret because those screenshots are for a Service Account (there is no client secret).
Still, with your message I tried using a regular OAuth 2.0 with my account, added the scope (that's what I was missing) and it seems to be connected!

Still... I'm stuck in a new issue.

I have this answer:

[{
  "error": {
    "code": 401,
    "message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
    "status": "UNAUTHENTICATED",
    "details": [
      {
        "@type": "type.googleapis.com/google.ads.googleads.v14.errors.GoogleAdsFailure",
        "errors": [
          {
            "errorCode": {
              "authenticationError": "OAUTH_TOKEN_HEADER_INVALID"
            },
            "message": "Oauth token HTTP header is malformed."
          }
        ],
        "requestId": "----------------------------"
      }
    ]
  }
}
]

I understand that this happens because the parameter Authorization is missing. It should look like this:
Authorization: Bearer ya29.AHES6ZRVmB7fkLtd1XTmq6mo0S1wqZZi3-Lh_s-6Uw7pk8pk8F53j4Q

(it's an example, that token is not real...)

Anyway, the connector is authorized.
image

I think I should add this parameter manually to make it work. But I can't see the token in EasyMorph. Also, I'm not sure why Easymorph is not sending the parameter considering that it has been authorized...

Ideas?
Thanks in advance!

I didn't realize that. So you must be using Service Account Flow.

Currently, our out-of-the-box support for OAuth only includes the standard OAuth Authorization Code Flow, which is commonly used for Web and Desktop applications to authorize the application on behalf of the user.

For Service Accounts, Google has a nonstandard OAuth Service Account Flow that utilizes a secret key and it looks like you have to use it with secrets file: Przepływ konta usługi OAuth  |  Google Ads API  |  Google for Developers

Unfortunately, we do not currently support this specific Service Account Flow out of the box. After reviewing Google's documentation, it is not clear how this flow operates at a low level, making it difficult to simulate it with EasyMorph actions. The documentation primarily focuses on the use of Google-provided libraries, rather than providing specifics on the flow at a per-request level.

Is using non-service account an option for you?

Yes! it is an option, and in fact I'm using it, but I'm stuck.
Right now I'm trying with a regular OAuth. The settings looks like this

image

image

I got the "Received verification code. You may now close this window. " at the end of the verification process.

In the API I have the Client ID created and enabled.

Consent screen is ready!

Headers ready!!

using this path

/v14/customers/[ACCOUNT ID HIDDEN]/googleAds:searchStream

using this query:
{
"query" : "SELECT campaign.name, campaign.status, segments.device,
metrics.impressions, metrics.clicks, metrics.ctr,
metrics.average_cpc, metrics.cost_micros
FROM campaign
WHERE segments.date DURING LAST_30_DAYS"
}

And still, I have this answer from Google:

[{
  "error": {
    "code": 401,
    "message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
    "status": "UNAUTHENTICATED",
    "details": [
      {
        "@type": "type.googleapis.com/google.ads.googleads.v14.errors.GoogleAdsFailure",
        "errors": [
          {
            "errorCode": {
              "authenticationError": "OAUTH_TOKEN_HEADER_INVALID"
            },
            "message": "Oauth token HTTP header is malformed."
          }
        ],
        "requestId": "t4aa_565pWf8dvw"
      }
    ]
  }
}
]

I has to be missing something... This is not with a Service Account, this is a regular OAuth process!

Hi @Daniel_Gonzalez !

I have attempted to recreate your environment using our test Google Ads account. This account is empty and intended for testing purposes only, but it should closely resemble your own account.

I have tested the configuration and it appears to be working correctly. Here are the details:

The connector

Connector OAuth settings



The action (all tabs)

As a proof of concept, I made a test request to the v14/customers:listAccessibleCustomers endpoint (Method: customers.listAccessibleCustomers  |  Google Ads API  |  Google for Developers).

Execution result

Hope this helps!

Also, attached is the project file, with all tokens and keys replaced by template strings. In the current example, the template connector is embedded within the project itself.

However, you should use a shared connector stored in either the server or desktop repository.

google-ads-webrequest.morph (4.2 KB)

Thank you! very useful information and file.
I still has this 401 error. If your file works for you, this is not in the EasyMorph side. That's very clear.
My best guess is... this is something on my auth screen, or something in GCP is missing. I'll keep trying and I will post here the solution