Domanda

I'm creating a website that makes use of the google calendar events API.

If I go to: https://developers.google.com/google-apps/calendar/v3/reference/events/list I can retrieve the events without any problem.

When I try to use GET https://www.googleapis.com/calendar/v3/calendars/myacc-3483%40pages.plusgoogle.com/events?key={YOUR_API_KEY} it's not working.

I registered an app in the google developer center

API key AIzaSyDvAwN5oqjCvdYZvfPeW0mUrfzyBn9KmrI
Referers    http://www.*****.be/
Activation date Jan 5, 2014 5:02 AM
Activated by     *****

I'm using my e-mail adress as the CalendarID (which is working on the above website) and I'm making a request from my domain:

var url = 'https://www.googleapis.com/calendar/v3/calendars/myacc-3483%40pages.plusgoogle.com/events?key=AIzaSyDvAwN5oqjCvdYZvfPeW0mUrfzyBn9KmrI';

$.ajax({
    url: url,
    type: 'get',
    success: function(data) {
        alert(data);
    }
});

Console output: GET https://www.googleapis.com/calendar/v3/calendars/myacc-3483%40pages.plusgoogle.com/events?key=AIzaSyDvAwN5oqjCvdYZvfPeW0mUrfzyBn9KmrI 403 (Forbidden)

I'm not sure what I'm doing wrong, everything seems to be correct..

È stato utile?

Altri suggerimenti

In simple terms, your ajax call is missing an Authorization header, which looks like

Authorization: Bearer 0b79bab50daca910b000d4f1a2b675d604257e42

Where "0b79bab50daca910b000d4f1a2b675d604257e42" is an access token. How you get an access token is non-trivial. Start with https://developers.google.com/accounts/docs/OAuth2

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top