Error with Google Ads API in WordPress Plugin: Class "OAuth2TokenBuilder" Not Found

173 views
Skip to first unread message

Teun Roos

unread,
Nov 30, 2023, 9:12:49 PM11/30/23
to Google Ads API and AdWords API Forum
Hello,

I am encountering an issue while integrating the Google Ads API into my WordPress plugin. Despite following the setup instructions and successfully installing the googleads-php-lib via Composer, I'm facing a persistent error.

**Error Description:**
When trying to initialize the Google Ads Client in my PHP code, I am receiving the following error message:

Fatal error: Uncaught Error: Class "OAuth2TokenBuilder" not found in /var/www/html/wp-content/plugins/[Your Plugin Directory]/ga-analytics-plugin.php on line [Line Number]


**Steps I Have Taken:**
1. Installed the `googleads-php-lib` using Composer in my WordPress plugin directory.
2. Included the Composer autoloader in my plugin PHP file: `require_once 'vendor/autoload.php';`
3. Attempted to use the `OAuth2TokenBuilder` class as per the library's documentation.

I suspect the issue might be related to [any specific suspicions you have, like namespace usage, file paths, etc.], but I am unable to pinpoint the exact cause. Has anyone encountered a similar issue or can provide insights on what might be going wrong?

Thank you in advance for your help!

Google Ads API Forum Advisor

unread,
Dec 1, 2023, 4:42:47 PM12/1/23
to roos....@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

After reviewing your concern, I understand that you are encountering an issue while integrating the Google Ads API into your WordPress plugin. Since, your issue is with the PHP client library, I would suggest you create a "New issue" with the developer who maintains the PHP client library using this link
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02qW0w4:ref"

Thanks,
Google Logo Google Ads API Team


Reply all
Reply to author
Forward
0 new messages