GooglePI NodeJS: calendar.events.watch gets push.webhookUrlNotHttps or pushWebhookBadDomain error

I followed all the settings required at https://developers.google.com/google-apps/calendar/v3/push (I think), and I'm trying to register my callback to view events using this code:

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); }); 

And I get an error message: 'No valid domain for WebHook callback: https://https://api.mysite.com', reason: 'pushWebhookBadDomain' . If I try to put the address as "api.mysite.com/notifications" (since it seems that https is duplicated), then I get an error message: 'WebHook callback must be HTTPS: api.mysite.com/notifications', reason: 'push.webhookUrlNotHttps'

Can anybody help me? thank you

+5
source share
1 answer

I have earned. Hope this can help someone. Here's how to do it:

in the Developer Console , the URL should be without https, but with the method enabled.

in Webmaster Tools , the URL should be linked to https, but only to the canonical domain.

My problem was that on the Developer Console I added all the features (4 domains in total), but the service just uses the first one, which was wrong.

The call was correct, with https and the method:

 resource: { id: "yourChannelId", type: 'web_hook', address: "https://api.mysite.com/notifications" } 
+4
source

Source: https://habr.com/ru/post/1241662/