Why Oauth Credentials is not working with PHP code?

54 views
Skip to first unread message

Amit Lahiri

unread,
Mar 5, 2020, 8:11:12 AM3/5/20
to AdWords API and Google Ads API Forum
Hi. 

I am facing the same problem. When I am clicking the Google Ads API to enable it, I am receiving the below error.
API solution not found with service name: googleads.googleapis.com

But I am quiet sure that I enable the API few days earlier. 
Why this error is given? 
How to resolve it?

I am running simple code, but getting the below error.
Fatal error: Uncaught Google_Service_Exception: { "error": { "errors": [ { "domain": "global", "reason": "authError", "message": "Invalid Credentials", "locationType": "header", "location": "Authorization" } ], "code": 401, "message": "Invalid Credentials" } }
............................

I am using the credentials 'secret.json' file which is active and I am using the correct client id and client secret as i found in the file as well as in APIs and Services Credentials console. The same information can be used without any error when I am using it with the OAuth Playground - https://developers.google.com/oauthplayground/.

Please help me to resolve the issue.


Thanks.

Google Ads API Forum Advisor Prod

unread,
Mar 5, 2020, 3:24:29 PM3/5/20
to ala...@nuundigital.com, adwor...@googlegroups.com
Hi Amit,

Can you please provide a screenshot of where you are seeing this error via reply privately to author?

Thanks,
Anthony
Google Ads API Team

ref:_00D1U1174p._5001UXUBNz:ref

Amit Lahiri

unread,
Mar 25, 2020, 12:02:48 PM3/25/20
to AdWords API and Google Ads API Forum
Hi Anthony.

Thank you for the reply. 

I have login to the Google Ads successfully using OAuth2 and received the access token. Then I am simple copying and pasting the below URL from example. But it is showin error. 

API Call
where {customer_id} will be replaced with Test account customer id.

Response
{
  "error": {
    "code": 401,
    "message": "Request is missing required authentication credential. 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"
  }
}

Why I am getting such error, while I have logged in on the other tab of the browser?

I am waiting for the reply. 


Thanks,
Amit 

Google Ads API Forum Advisor Prod

unread,
Mar 25, 2020, 3:19:43 PM3/25/20
to ala...@nuundigital.com, adwor...@googlegroups.com
Hi Amit,

You will need to make sure when making API calls you are logged into the account you used to create your credentials. Please try making this call in an incognito window logged into the account, so that you can make sure that you aren't logged into any other accounts.

Regards,

Anthony
Google Ads API Team

ref:_00D1U1174p._5001UXWet9:ref

Amit Lahiri

unread,
Mar 25, 2020, 3:48:48 PM3/25/20
to AdWords API and Google Ads API Forum
Hi Anthony.

Thanks for the reply. 

I am using the same email address for creating OAuth2 Client Id and user log in. Is this what you mean? 
What would be the next steps?

Awaiting your reply. 


Thanks, 
Amit 

Google Ads API Forum Advisor Prod

unread,
Mar 26, 2020, 2:52:14 PM3/26/20
to ala...@nuundigital.com, adwor...@googlegroups.com
Hi Amit,

Yes, that is correct. Can you please reply privately to author a screenshot of what you are seeing?

Thanks,
Reply all
Reply to author
Forward
0 new messages