Missing Oauth2 token on createCustomerClient request

90 views
Skip to first unread message

Emanuele Isaia

unread,
Jun 23, 2022, 7:08:50 AM6/23/22
to Google Ads API and AdWords API Forum
Hi, I'm having an issue using Google Ads SDK, my application in on Laravel 8 and I'm using PHP Google libraries, I'm trying to create a customer client direclty linked with my manager ID, for doing it I'm using an external Business account that log in with my application credentials and next I generate a googleAdsClient form a php.ini file with service account credentials, I'm sure until this i did everything right, but next when i call

$customerServiceClient = $googleAdsClient->getCustomerServiceClient();

And

$response = $googleAdsClient->createCustomerClient($managerCustomerId, $customer);

The response return

  1. 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."
  2. status: "UNAUTHENTICATED"
It's like the client that I've generated by using:

            $oAuth2Credential = (new OAuth2TokenBuilder())
                    ->fromFile($key_file)
                    ->build();

            $googleAdsClient = (new GoogleAdsClientBuilder())
                    ->withOAuth2Credential($oAuth2Credential)
                    ->fromFile($key_file)
                    ->build();

does not have an access token for this call

So I'm here to ask how can it be possible? Is possible to use a service account for generate Clients to Managers ID? Or why auth token is missing if the googleAdsClient build successfully? Is there another better way to do the same thing using createCustomerClient?

Google Ads API Forum Advisor

unread,
Jun 23, 2022, 10:31:13 AM6/23/22
to emanuele....@gmail.com, adwor...@googlegroups.com

Hi,

Thank you for raising this concern to the Google Ads API Forum.

With regard to your questions, let me answer you generally.

Moving forward, service accounts are used when you need a domain-specific feature. With this, could you confirm if you already followed this statement, because we strongly recommend using the OAuth Desktop and Web Application Flows instead of service accounts. However, to have a clearer view for this issue, could you please provide the complete request and response logs with requestID and request header that generated on your end? If you haven't yet, logging can be enabled by navigating to the Client libraries > Your client library (ex. Java) > Logging documentation, which you can access from this link. For security purposes, you can provide it via the Reply privately to author option. If this option is not available, then send it instead on this email address googleadsa...@google.com.

Best regards,

Google Logo
Jinky
Google Ads API Team
 


ref:_00D1U1174p._5004Q2bzUez:ref
Reply all
Reply to author
Forward
0 new messages