OiO.lk Blog PHP Trying to automate URL inspection in google but cannot get past authentication
PHP

Trying to automate URL inspection in google but cannot get past authentication


Google isn’t clear to me on how I can login to the google search console API.

I’m using PHP and CURL.

I passed in for the URL: "sites/example.com/searchAnalytics/query?key=mykey" and I passed in json parameters for the start and end date. mykey was assigned to me after using google cloud to generate one.

When I execute the curl request through PHP, I receive this error:

"API keys are not supported by this API. Expected OAuth2 access token or other authentication credentials that assert a principal."

Oauth2 wouldn’t be for me because I’m using an private apache server on my computer to handle the requests.

So I looked into google cloud and I’m able to get a unique ID, a client ID and an email ending in iam.gserviceaccount.com

What values do I feed into CURL when making an authenticated request? I would assume I’d place them in as an HTTP header but google is not clear on this.

Please help.

I tried the API key but the google search API wouldn’t allow that as authentication.



You need to sign in to view this answers

Exit mobile version