我正在使用“ watch”方法从Google Calendar API请求推送通知,并且它向我的监视请求返回“ 200:确定”,但是却无声地无法发送通知。我如何诊断它们为什么失败?
背景:
我的域具有有效的SSL证书
我的域已在Google Cloud Platform Console中成功注册
保存并刷新不会丢失它,就像Google push notifications - Unauthorized WebHook callback channel
我的网络应用通过以下代码请求通知:
import {Directive, HostBinding, HostListener} from '@angular/core';
@Directive({
selector: '[appDropdown]'
})
export class DropdownDirective {
@HostBinding('class.show') toggle = false;
@HostListener('click') dropdownToggle() {
this.toggle = !this.toggle;
console.log('clicked');
}
}
对此请求发送了“ 200-OK”响应。但是没有发送通知。另外,更令人困惑的是,当我通过https://developers.google.com/apis-explorer/#p/calendar/v3/calendar.events.watch尝试相同的监视请求时,收到以下错误响应:
function watchCalendar(calendarId) {
gapi.client.calendar.events.watch({
calendarId: calendarId,
resource: {
"id": uuid(),
"type": "web_hook",
"address": MY_DOMAIN,
"token": "source=GoogleCalendarEventChange",
"expiration": new Date().setMinutes(new Date().getMinutes() + 60),
}
}).then((watchResponse)=>{
console.log(`Watch on this calendar requested.
Response: ${watchResponse.status}.`);
})
}
其中MY_DOMAIN是我已注册的真实域。我在做什么错了?