You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to access accessible customers of a given refresh token, if the account is a manager account, google requires the login-customer-id parameter to be passed as described here
I am not sure how this could ever work, to even get a developer token to access the API, the google ads account HAS to be a manager account.. or am I misunderstanding something?
try {
const {tokens} = await getGoogleAdsTokens(data.brand$key);
// Create an instance of the Google Auth Client
const oauth2Client = new google.auth.OAuth2(
process.env.GOOGLE_CLIENT_ID,
process.env.GOOGLE_CLIENT_SECRET,
"http://localhost:3000/callback"
);
oauth2Client.setCredentials({
refresh_token: tokens.refresh_token
});
// Get the access token
const accessToken = await oauth2Client.getAccessToken();
// Make a request to the Google Ads API
const response = await fetch('https://googleads.googleapis.com/v8/customers', {
headers: {
'Authorization': `Bearer ${accessToken.token}`,
'developer-token': process.env.GOOGLE_ADS_DEVELOPER_TOKEN
}
});
const data = await response.json();
return data.customers;
} catch(error) {
logger.error(`Failed to get Google Ad accounts: ${error}`);
throw new Error('Failed to get Google Ad accounts');
}
When trying to access accessible customers of a given refresh token, if the account is a manager account, google requires the
login-customer-id
parameter to be passed as described herehttps://developers.google.com/google-ads/api/rest/auth#login_customer_id
However, this parameter is hardcoded in the service which has the
listAccessibleCustomers
in the code to be an empty string.There should be a way to pass this optionally to that service so that the method works.
When I went through their REST API directly and passed in the parameter, everything worked as expected.
The text was updated successfully, but these errors were encountered: