I'm attempting to cURL the Google Ads API with the following PHP code:
$ch = curl_init();And the response is:
{ "error": { "code": 401, "message": "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.", "status": "UNAUTHENTICATED" } }What I believe the issue to be is on the "Authentication" field. So far, I've put the following in that field(and failed each time):
So, I could appreciate any and all help, since I'm running out of ideas and don't know what to do.
Hi,
Thank you for reaching out to Google Ads API Forum.
I see that you encountered an error with the message: "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential.” With this, could you try following the steps stated in this guide (https://developers.google.com/google-ads/api/docs/best-practices/troubleshooting#ensuring_connectivity) for best practices? Additionally, please check this documentation (https://developers.google.com/google-ads/api/docs/client-libs/php) for the guides in setting up the client library with OAuth.
Furthermore, since you are using the latest API version which is v14, you may also check this reference (https://developers.google.com/google-ads/api/docs/client-libs#php) for the supported versions.
Please let us know how it goes.
![]() |
Google Ads API Team |