I am using google calendar api to export an event to google calendar, when the users logins to my web app he creates an event and exports the same event to google calendar, this a basic requirement. I have used this code for the authentication
<body>
<div id="panel"></div>
<script type="text/javascript">
var myService;
google.load("gdata", "1");
google.setOnLoadCallback(getMyFeed);
function logMeIn() {
scope = "http://www.google.com/calendar/feeds";
var token = google.accounts.user.login(scope);
}
function setupMyService() {
myService = new google.gdata.calendar.CalendarService('GoCalender');
logMeIn();
}
function handleMyFeed(myResultsFeedRoot) {
alert("This feed's title is: " + myResultsFeedRoot.feed.getTitle().getText());
}
function handleError(e) {
alert("There was an error!"+ e.cause ? e.cause.statusText : e.message);
}
function getMyFeed() {
setupMyService();
var feedUrl = "https://www.google.com/calendar/feeds/jeevan@stalkninja.com.com/private/full";
myService.getEventsFeed(feedUrl, handleMyFeed, handleError);
}
</script>
<img src="google-app-engine1.png" style="postion:absoulute; width:50px"></img>
though I have not specified the create single event code here, I am not to auth user to there google accounts. The google server is giving a error which says --
"The page you have requested cannot be displayed. Another site was requesting access to your Google Account, but sent a malformed request. Please contact the site that you were trying to use when you received this message to inform them of the error. A detailed error message follows:
The "next" parameter was bad or missing."
What is the problem kindly help me to get th开发者_StackOverflow中文版e solution for this. I am a novice to google apis.
Are you running this from a url beginning with file:// ? If so it will not work, you need a local web server so the urls begin something like http://localhost/, read up on installing one. If you already have a web server, make sure the path/url to your file does not contain spaces or other characters that need encoding - I've found this can also cause problems.
I just ran into the same problem when accessing the Calendar API from javascript loaded from my local disk. Publishing the files to a web server and accessing them using the http protocol solved the problem. I'm guessing the API tries to append the origin host name in the next parameter, but when it is redirecting, and if you run it from a local file there won't be any host name (obviously).
精彩评论