Why am I getting 401 errors on my Google Ads workflow and why does the app/integration appear as invalid?

This topic was automatically generated from Slack. You can find the original thread here.

Getting 401 erros on my Google Ads workdflow (p_2gCJ7GZ). When I edit, it shows as if the google ads app/integration is no longer valid. Any clues?

cc

The error returned from G.Ads endpoint is:

{
    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: [ {
        errorCode: { authenticationError: 'OAUTH_TOKEN_HEADER_INVALID' },
        message: 'Oauth token HTTP header is malformed.'
    } ]
}

& @U036XC1NX61 as it might be realted to PR #9922 merged 3 hours ago

I will take a look

Hi Pedro, looking into this now. When you authenticated in the past, did you provide your own developer token to make API calls for your workflow?

I probably did since I had this workflow before the official integration existed

my request headers look like this:


      headers: {
        Authorization: `Bearer ${this.google_ads.$auth.oauth_access_token}`,
        'developer-token': '<REDACTED>',
        'login-customer-id': '<REDACTED>',
      },

Hey Pedro, we were doing some maintenance on the app, I’ve reactivated the Google Ads app and you should be able to see it now. Please let me know if this is working for you now!

Thanks. I can see the app now. I’m still getting the error though. Will take a look on the token I’m getting from the app.

can you try to reconnect your account and see if this fixes it?

sure. will do that now

done. Do I have to trigger a new workflow deployment for it to take effect ?

Yes, let me know if you still get a 401 upon reconnecting and redeploying

testing in builder still fails. let us see after deployment

Hmm, if it’s failing in builder I don’t think it would work in deployment either. What is the API call that you’re trying to make?

also: it seems I can’t deploy due to plan issue. Not sure why since I did not change plans.

here’s the API call code:


const url = 'https://googleads.googleapis.com/v13/customers/2953977290:uploadClickConversions';

const conversionDate = new Date();
const conversionDateStr = conversionDate.toISOString().substring(0, 19).replace('T', ' ') + '+00:00';
const data = {
    partialFailure: true,
    conversions: [
        {
            gclid: gclid,
            conversionAction: `customers/2953977290/conversionActions/${conversionActionId}`,
            conversionDateTime: conversionDateStr,
        },
    ],
};
const config = {
    headers: {
        Authorization: `Bearer ${this.google_ads.$auth.oauth_access_token}`,
        'developer-token': '<REDACTED>',
        'login-customer-id': '<REDACTED>',
    },
};
try {
    const response = await [axios.post](http://axios.post)(url, data, config);
    return response.data;
} catch (error) {
    if (error.response) {
        console.log(error.response.status);
        console.log(error.response.data);
        console.log(error.response.data?.error?.details?.[0]?.errors);
    }
    throw error;
}

the simplest vanilla workflow works fine:

Maybe I’m using an outdated api version. Let me isolate that.