I am trying to insert an event to a my Google Calendar using
Javascript and keep getting 'Developer key validation failed' and
'Authorization required' errors on IE7 and Firefox both.

My calendar is public so has no problem with read.

Is there anything I missed for the authentication. I am following
google samples exactly.

Below is the code I am using.

Any suggestions will be appriciated.

Thanks!




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml";>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/
>


<!-- key for http://localhost:8088/googleTest/ -->
<script src="http://www.google.com/jsapi?
key=ABQIAAAAKMkS_qnBtd4UFpDtiu5z2BSCxHS84X7-
vKv9IfKEK5BDMGaoPxQhPuht8Z1UZ6o14uvGstFE9eh11g" type="text/
javascript"></script>

<script type="text/javascript">
<!--
/* Loads the Google data JavaScript client library */
google.load("gdata", "1");


function logMeIn() {
  scope = "http://www.google.com/calendar/feeds/";;
  var token = google.accounts.user.login(scope);
}

function logMeOut() {
  google.accounts.user.logout();
}


function getAllCal()
{
/*
 * Add a reminder to event
 */

// Create the calendar service object
var calendarService = new google.gdata.calendar.CalendarService
('GoogleInc-jsguide-1.0');

//logMeIn();

// The default "private/full" feed is used to insert event to the
// primary calendar of the authenticated user
//var feedUri = 'http://www.google.com/calendar/feeds/default/private/
full';
var feedUri = "http://www.google.com/calendar/feeds/
[email protected]/private/full";

// Create an instance of CalendarEventEntry representing the new event
var entry = new google.gdata.calendar.CalendarEventEntry();

// Set the title of the event
entry.setTitle(google.gdata.Text.create('JS-Client: add event
reminder'));

// Create a When object that will be attached to the event
var when = new google.gdata.When();

// Set the start and end time of the When object
var startTime = google.gdata.DateTime.fromIso8601
("2009-08-21T10:00:00.000Z");
var endTime = google.gdata.DateTime.fromIso8601
("2009-08-21T11:00:00.000Z")
when.setStartTime(startTime);
when.setEndTime(endTime);

// Create a Reminder object that will be attached to the When object
var reminder = new google.gdata.Reminder();

// Set the reminder to be 30 minutes prior the event start time
reminder.setMinutes(30);

// Set the reminder method to be 'alert', a pop up alert on the
browser
reminder.setMethod(google.gdata.Reminder.METHOD_ALERT);

// Add the reminder with the When object
when.addReminder(reminder);

// Add the When object to the event
entry.addTime(when);

// The callback method that will be called after a successful
insertion from insertEntry()
var callback4 = function(result) {
  alert('event created with reminder!');
}

// Error handler will be invoked if there is an error from insertEntry
()
var handleError4 = function(e) {
  alert('handleError4=' + e);
  alert(e.cause ? e.cause.statusText : e.message);
}

// Submit the request using the calendar service object
calendarService.insertEntry(feedUri, entry, callback4,
    handleError4, google.gdata.calendar.CalendarEventEntry);


}

-->
</script>

</head>


<body>

<button type="button" onclick="getAllCal()" >Click Me!</button>

<p><img src="mag.gif" title="Loading" alt="Loading"></p>

</body>
</html>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Calendar Data API" group.
To post to this group, send email to 
[email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to