首页 文章

FullCalendar:在没有API密钥的情况下显示来自PUBLIC谷歌日历(比如美国假期)的事件

提问于
浏览
0

我的网站为用户提供了使用完整日历以及他们创建的事件来显示我自己显示的gcal Feed网址的功能

calendarUrl = "link to public calendar url"

$('#calendar').fullCalendar({
    eventSources: [      
        {
          url: calendarUrl               
        },
        {
          url: "/user-events"
        }      
    ]    
});

现在当然这不起作用 . 这需要googleCalendarApiKey . 我不希望那些不懂技术的用户使用Google Developer Console创建项目并提供API密钥 . 另外,我如何显示美国假期等公共日历中的事件 . 如何获取该日历的Api密钥 .

似乎应该有一种方法来显示没有API密钥的PUBLIC谷歌日历中的事件 .

2 回答

  • 0

    这对我有用:

    eventSource = {
        googleCalendarApiKey:'xxx',
        url: 'https://www.googleapis.com/calendar/v3/calendars/usa__en%40holiday.calendar.google.com/events?key=xxx',
        className: 'gcal-event', // an option!
        currentTimezone: 'America/Chicago' // an option!
      }
    
  • 1

    How to Define which Calendar to Connect to using Google Calendar API v3 Service找到答案

    你需要自己的钥匙来显示任何公共日历 - 而不是他们的钥匙!!我发现服务器应用程序的密钥对我而言并不适用于浏览器 .

    $('#calendar').fullCalendar({
      googleCalendarApiKey: "<key for server apps>",
      eventSources: [      
        {
          googleCalendarId: "email of public calendar"               
        }      
      ]    
    });
    

相关问题