Menu

Bugfix: Google Analyticator Fatal error: Uncaught exception ‘Google_AuthException’ with message ‘Error refreshing the OAuth2 token

analytics-logo1I typically use the Google Analyticator plugin to setup Google Analytics for client projects and haven’t had that many issues using it over the years and I probably have it on 100+ websites. Well, lately I’ve noticed a few client dashboards w/ the following error message:

Fatal error: Uncaught exception ‘Google_AuthException’ with message ‘Error refreshing the OAuth2 token, message: ‘{ “error” : “invalid_grant” }” in /home/xxxxx/public_html/cms/wp-content/plugins/google-analyticator/google-api-php-client/src/auth/Google_OAuth2.php:279 Stack trace: #0 /home/ffbsst/public_html/cms/wp-content/plugins/google-analyticator/google-api-php-client/src/auth/Google_OAuth2.php(239): Google_OAuth2->refreshTokenRequest(Array) #1 /home/xxxxx/public_html/cms/wp-content/plugins/google-analyticator/google-api-php-client/src/auth/Google_OAuth2.php(216): Google_OAuth2->refreshToken(‘1/zd433lhEC7Azn…’) #2 /home/xxxxx/public_html/cms/wp-content/plugins/google-analyticator/google-api-php-client/src/service/Google_ServiceResource.php(166): Google_OAuth2->sign(Object(Google_HttpRequest)) #3 /home/xxxxx/public_html/cms/wp-content/plugins/google-analyticator/google-api-php-client/src/contrib/Google_AnalyticsService.php(183): Google_ServiceResource->__call(‘list’, Array) #4 /home/xxxxx/public_html/cms/wp-co in /home/ffbsst/public_html/cms/wp-content/plugins/google-analyticator/google-api-php-client/src/auth/Google_OAuth2.php on line 279

I did a little research on this and found out that I’m not the only one seeing this issue, see WordPress Support Forum Here…

I finally did find a solution shared by Jeremy Clarke that seems to work. If you will checkout his gist here and replace the Google_OAuth2.php file w/ his code, then de-activate and reactivate & reset your Google Analyticator plugin you can get your site back up and running.

 

No word on what causes this bug to happen, it’s pretty sporadic among my clients…

About Cotton Rohrscheib

Cotton Rohrscheib is the CEO of Rohrscheib Capital Partners. Over the past 20 years he has been associated with numerous projects in the IT, Healthcare, and Agriculture industries. Born a serial entrepreneur, Cotton has personally been involved in several startups, product launches, and brand acquisitions during his career and has consulted on hundreds of projects for clients around the world. Today he still services the marketing and consulting needs for clients while trying to maintain a healthy balance between work and being a good husband and father to his wife, Donna, and their son, Spencer.

This site uses Akismet to reduce spam. Learn how your comment data is processed.