I am trying to learn the google Calendar API and unfortunately I've hit a snag.
I can't seem to get a the auth token to take.
I've done the quickstart.php and it works using CLI, but I want a web based app that will add to the users calendar once they have gone through auth to accept.
I've got to the point where I'm going to oauth, it's asking me to choose an account and to accept that "XXX" wants to manage the calendar, I accept, it returns back to the redirect URL with a GET['code'] - every piece of documentation then suggests you have to call;
$client->fetchAccessTokenWithAuthCode($_GET['code']);
Which I do, but then calling "$client->getAccessToken();"
returns null
I have no idea where I'm going wrong, there's loads of documentation about the google API but loads of conflicting information too.
Any help would be greatly appreciated.
-Edit I've now managed to store the returned json but it says it's unauthorised...
{"error":"invalid_client","error_description":"Unauthorized"}
It's using the same clientID as the quickstart.php is, the same client_secret.json that matches the clientID
I'm still at a loss as to why it's returning incorrectly.