Basic Setup, PHP, Service account flow

48 views
Skip to first unread message

Michael Shepard

unread,
Apr 20, 2023, 10:17:15 AM4/20/23
to Google Ads API and AdWords API Forum
I am attempting initial setup and testing for my project. I have installed the google-ads-php library in my project with composer, I have created a service account, and downloaded my JSON key. I have created the google_ads_php.ini. I am attempting to create the basic "GetCampaigns" utility using the example provided in the repo. when I execute from my command line I get
"PHP Fatal error:  Uncaught GuzzleHttp\Exception\ClientException: Client error: `POST https://oauth2.googleapis.com/token` resulted in a `401 Unauthorized` response:
{
  "error": "unauthorized_client",
  "error_description": "Client is unauthorized to retrieve access tokens using this  (truncated...)
 in /var/www/hydraulics/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113"

Any help would be appreciated

Google Ads API Forum Advisor

unread,
Apr 20, 2023, 1:59:14 PM4/20/23
to shep...@gmail.com, adwor...@googlegroups.com

Hi,

Thank you for reaching out to Google Ads API Forum.

Can you confirm if you have followed the guide outlined in this PHP client library guide? If yes, and the still issue persists, then you may provide to us the complete API logs (request and response with the request-id) generated from your end so we can investigate further.

For the PHP client library, logging can be enabled by following the PHP Logging guide.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.

Reference links included in this email:

Regards,

Google Logo Google Ads API Team


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