GoogleAPI NodeJS:calendar.events.watch获取错误push.webhookUrlNotHttps或pushWebhookBadDomain

dan*_*ior 5 google-calendar-api node.js google-api-nodejs-client

我已按照https://developers.google.com/google-apps/calendar/v3/push(我认为)中的所有设置进行操作,并且我正在尝试注册我的回调网址以观看事件,并使用以下代码:

calendar.events.watch({

    auth:jwtClient,
    resource: {
        id: "yourChannelId",
        type: 'web_hook',
        address: "https://api.mysite.com/notifications"
    },
    calendarId: "mycalendarId"
}, function(error, response) {
    if (error) {
        console.log(error);
        return;
    }
    console.log(response);

});
Run Code Online (Sandbox Code Playgroud)

我得到了错误message: 'No valid domain for WebHook callback: https://https://api.mysite.com', reason: 'pushWebhookBadDomain'.如果我尝试将地址设置为"api.mysite.com/notifications"(因为似乎https正在重复),那么我得到错误message: 'WebHook callback must be HTTPS: api.mysite.com/notifications', reason: 'push.webhookUrlNotHttps'

有人可以帮我吗?谢谢

dan*_*ior 4

我让它工作了。我希望它可以帮助别人。方法如下:

在开发者控制台上,URL 必须不带 https,但包含方法。

在网站站长工具上,URL 必须带有 https,但只能是规范域。

我的问题是,在开发人员控制台上,我添加了所有可能性(总共 4 个域),但该服务仅使用第一个,这是错误的。

在调用中,是对的,带有 https 和方法:

resource: {
    id: "yourChannelId",
    type: 'web_hook',
    address: "https://api.mysite.com/notifications"
}
Run Code Online (Sandbox Code Playgroud)