I am having issues calling Calendar:Insert via Google's API https://www.googleapis.com/calendar/v3/calendars
I don't believe there are authorization/permission issues, the access_token is acquired via a refresh_token with the following scope: "https://www.googleapis.com/auth/calendar"
When I use a valid access_token to perform GET there are no issues, but this is a POST and I consistently get this response:
{"error":
{ "errors":
[{ "domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}],
"code": 401,
"message": "Invalid Credentials"
}
}
Here is the Railo code I'm running, I've stripped it of all pretense and nuance:
<cfhttp url="https://www.googleapis.com/calendar/v3/calendars" charset="utf-8" method="post">
<cfhttpparam type="header" name="Authorization" value="bearer #arguments.access_token#" />
<cfhttpparam type="formfield" name="summary" value='hello world' />
</cfhttp>
Here is an example of a get that works just fine:
<cfhttp url="https://www.googleapis.com/calendar/v3/calendars/#arguments.calendarID#/events?access_token=#arguments.access_token#" charset="utf-8" method="get" />
So far I've attempted placing the access_token in a variety of ways. As a query parameter, as a json struct in the cfhttpparam type="body" with no luck
This stackoverflow question indicates that the Google Calendar API documentation neglects to mention a required parameter "minAccessRole". I've fiddled with that too to no avail.