Google Calendar API CalendarList.list() returns a weird object - JS
I want to get the list of the calendars of a user with JS by using CalendarList.list() as stated in the documentation. But for me I only get a weird object as response, that always looks like this:
{
"Yd": 1,
"mb": {
"Vf": null,
"yh": {
"path": "/calendar/v3/users/me/calendarList",
"method": "GET",
"params": {},
"headers": {},
"root": "https://www.googleapis.com",
"apiId": "calendar:v3"
},
"Cl": "auto",
"G_": false,
"VN": false,
"aQ": false
}
}
I'm using the standard code from the quickstart which works fine for me, only this one request returns a weird result.
It looks like this in my code (just the part of it that should be interesting):
function initClient() {
gapi.client.init({
apiKey: API_KEY,
clientId: CLIENT_ID,
discoveryDocs: DISCOVERY_DOCS,
scope: SCOPES
}).then(function() {
// Listen for sign-in state changes.
gapi.auth2.getAuthInstance().isSignedIn.listen(updateSigninStatus);
// Handle the initial sign-in state.
updateSigninStatus(gapi.auth2.getAuthInstance().isSignedIn.get());
authorizeButton.onclick = handleAuthClick;
signoutButton.onclick = handleSignoutClick;
}, function(error) {
changeSpanText(JSON.stringify(error, null, 2));
});
}
function updateSigninStatus(isSignedIn) {
if (isSignedIn) {
authorizeButton.style.display = 'none';
signoutButton.style.display = 'flex';
changeSpanText("🎉 You have been logged in succesfully");
console.log(gapi.client.calendar.calendarList.list());
} else {
authorizeButton.style.display = 'flex';
signoutButton.style.display = 'none';
changeSpanText("");
}
}
Comments
Post a Comment