[AuthenticationError.OAUTH_TOKEN_INVALID @ ; trigger:'<null>']

69 views
Skip to first unread message

andrei vladimirovich

unread,
Jul 26, 2021, 5:02:48 AM7/26/21
to AdWords API and Google Ads API Forum
I inserted 
developerToken
clientCustomerId
clientId, 
clientSecret,
refreshToken,

on my adsapi_php.ini file.
And I am trying to get traffic estimates for new keywords with PHP code.
Now I am facing on this error, 
Fatal error: Uncaught Google\AdsApi\AdWords\v201809\cm\ApiException: [AuthenticationError.OAUTH_TOKEN_INVALID @ ; trigger:'<null>'] in ...

Please let me know, why this error has come, and how can I solve this problem.

Best Regards
Andrei

Google Ads API Forum Advisor

unread,
Jul 26, 2021, 10:17:06 PM7/26/21
to andre...@gmail.com, adwor...@googlegroups.com

Hi Andrei,

Thanks for reaching out to us.

The OAUTH_TOKEN_INVALID error indicates that the access token you used with the HTTP header is incorrect or expired. 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 the error persists with the said token, even after following the steps from the above guide, I would recommend that you reach out instead to the Google API Console Support team via this link.

In addition, you may also double check if you still have access to the project where you’re generating the OAuth credentials in the developer console. It could be one of the reasons that you get the token invalid errors. 

Regards,

Google Logo
Yasar Ramjan Makandar
Google Ads API Team
 


ref:_00D1U1174p._5004Q2JDhN8:ref

andrei vladimirovich

unread,
Jul 27, 2021, 3:38:01 AM7/27/21
to AdWords API and Google Ads API Forum
I really appreciate your quick reply.
I defined refresh token on adsapi_php.ini. 
Do I need to do define the access token, too? 
If yes, How can do that, and Where do I need to define that access token?

I am trying to use this script.

Best Regards
Thank you.

Google Ads API Forum Advisor

unread,
Jul 27, 2021, 11:03:21 PM7/27/21
to andre...@gmail.com, adwor...@googlegroups.com

Hi Andrei,

Thanks for getting back to us

To generate an access token, kindly follow the Installed application (recommended) or the Web application with a web flow. Note that whether you are using web flow or the desktop app flow, the client library you are using should already automatically take care of the authentication on your behalf. For more information on Authentication, you may refer to this API documentation.

Let us know if you have any further questions.

Regards,

Google Logo
Yasar
Google Ads API Team
 


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