Ruby Google Calendar Integration观看事件/推送通知

以下代码片段打印日历ID的事件,配置了所有日历并尝试在日历上设置观看通知。

一切都有效但手表事件方法。 我收到此错误:apis / core / http_command.rb:212:在`check_status’中:未经授权(Google :: Apis :: AuthorizationError)

这个看起来很奇怪,因为日历和事件检索工作正常。

service = Google::Apis::CalendarV3::CalendarService.new service.client_options.application_name = APPLICATION_NAME service.authorization = authorize # Fetch the next 10 events for the user calendar_id = 'us7i4kt2to4mpb0b5et1f9f4co@group.calendar.google.com' response = service.list_events(calendar_id, max_results: 10, single_events: true, order_by: 'startTime', time_min: Time.now.iso8601) puts "Upcoming events:" puts "No upcoming events found" if response.items.empty? response.items.each do |event| start = event.start.date || event.start.date_time puts "- #{event.summary} (#{start})" end @calendar_list = service.list_calendar_lists @calendar_list.items.each do |calendar| puts " #{calendar.summary} => #{calendar.id}" end channel = Google::Apis::CalendarV3::Channel.new(address: 'https://66724be7.ngrok.io', id: 100, type: "web_hook") puts "Channel created " webhook = service.watch_event('us7i4kt2to4mpb0b5et1f9f4co@group.calendar.google.com', channel, single_events: true, time_min: Time.now.iso8601) 

我收到此错误:apis / core / http_command.rb:212:在`check_status’中:未经授权(Google :: Apis :: AuthorizationError)

在网上找不到任何相关内容