Reputation: 4082
On my site I ran some PHP scripts that imported Gmail contacts using Oauth 2, a few months ago it stopped working without me changing anything. Something must have changed with Google API and/or policy, can someone help me identify the problem ?
The initial url request looks like this (replaced my domain with example.com):
https://accounts.google.com/o/oauth2/auth?scope=https://www.google.com/m8/feeds&state=whatever&redirect_uri=http://www.example.com/import/gmail-callback&response_type=token&client_id=293090831245.apps.googleusercontent.com&approval_prompt=force
That prompts the user to accept/decline access to their data (looks good), once user accepts, it is redirected back to my site, here I make a request to get user's contacts based on the received token:
file_get_contents("https://www.google.com/m8/feeds/contacts/default/full?access_token=".$_GET['access_token']."&alt=json&v=3.0&updated-min=2004-03-16T00:00:00&max-results=3000");
But Google now replies with
HTTP request failed! HTTP/1.0 403 Forbidden
Any tips ?
Upvotes: 0
Views: 346
Reputation: 4082
I found the answer, some changes in Google Developer's console set the contacts API to OFF by default. It worked after I logged to developer console and enabled contacts API:
Upvotes: 1