Uncaught GuzzleHttp\Exception\ClientException / invalid_grant

142 views
Skip to first unread message

Laurent Petr

unread,
Mar 4, 2022, 4:53:08 AM3/4/22
to Google Ads API and AdWords API Forum
Hi all,

I'm still trying to use the API for the first time.
I have created the identification keys in the console.
I didn't succeed making work example/Authentification php scripts, but I could get a refresh token with my own script, with "https://www.googleapis.com/auth/adwords" as scope and "offline" as type.

I inserted all the keys / tokens in google_ads_php.ini and tryed a first account access.
I tryed with the sample GetCampaigns.php and with my own script, but when searchStream is executed, I have the error :
Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error: `POST https://oauth2.googleapis.com/token` resulted in a `400 Bad Request` response: { "error": "invalid_grant", "error_description": "Bad Request" } 

The account witch I use the customer ID in searchStream is a child account of the admin account witch I use the developper token.

I tryed to delete the keys in the console and to create new, but the problem is the same.

How should I do?
Thanks!
Laurent




Anita Gupta

unread,
Mar 4, 2022, 7:40:52 AM3/4/22
to Google Ads API and AdWords API Forum
Hello Team,

I am also facing the same issue. Please help.

Google Ads API Forum Advisor

unread,
Mar 7, 2022, 1:36:23 AM3/7/22
to anita...@comfortclick.co.uk, adwor...@googlegroups.com

Hi Laurent/Anita,

 

Thank you for reaching out. The "invalid_grant” error usually indicates an issue with the refresh token. That said, you’ll need to regenerate credentials and refresh tokens. You may refer here to this guide for the steps on how you can regenerate credentials and refresh tokens.

 

If you are still having an issue, please share the complete request and response logs with request ID so we can take a closer look at the issue. Please send the requested details via the Reply privately to author option. If this option is not available, you may send the details directly to our googleadsa...@google.com alias instead.

 

Regards,

Google Logo
Kevin Gil
Google Ads API Team
 


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