Reputation: 96
Any solution for the issue. This seems to be not working
{
"error": {
"errors": [
{
"domain": "global",
"reason": "push.webhookUrlUnauthorized",
"message": "Unauthorized WebHook callback channel: https://xxxxx"
}
],
"code": 401,
"message": "Unauthorized WebHook callback channel: https://xxxxx"
}
}
Anyway to resolve this issue
Upvotes: 2
Views: 4201
Reputation: 126
Push notifications require that you've verified domain ownership, so cannot be created in the API Explorer, as it doesn't provide a means of associating the requests with a project on which you've verified ownership. This can be done in the OAuth Playground, if you use project credentials, as detailed below:
Configure the API project:
Configure the OAuth Playground:
Authorize API requests:
Click 'Enter request body', and enter your request, for example:
{
"id": "c887ce64-adc8-4007-952c-a172c376b30d",
"type": "web_hook",
"address": "https://example.com/watch"
}
Click 'Close' when done.
https://www.googleapis.com/calendar/v3/calendars/[email protected]/events/watch
Click 'Send the request.'
You should receive a response similar to:
{
"resourceId": "DmuNd7MI-w7qwW1FxDNf_pdqk7Y",
"kind": "api#channel",
"expiration": "1507327087000",
"id": "c887ce64-adc8-4007-952c-a172c376b30d",
"resourceUri": "https://www.googleapis.com/calendar/v3/calendars/[email protected]/events?maxResults=250&alt=json"
}
Note: Push notifications for other APIs, for example the Directory API, may have additional parameters. Check the relevant Reference documentation for details.
Upvotes: 5
Reputation: 96
This fix helped me to solve the issue. I had not mentioned the callback link in the google applications authorized redirect urls. Upon addition i was able to generate watch events and was able to receive push notification message as well
Upvotes: 2
Reputation: 17651
To use Push Notifications in Google Calendar make sure you followed the instructions here:
For example, if you plan to use https://yourdomainexample.com/notifications
as your receiving URL, you need to register https://yourdomainexample.com
.
Set up your receiving URL, or "Webhook" callback receiver.
This is an HTTPS server that handles the API notification messages that are triggered when a resource changes.
Set up a notification channel for each resource endpoint you want to watch.
A channel specifies routing information for notification messages. As part of the channel setup, you identify the specific URL where you want to receive notifications. Whenever a channel's resource changes, the Google Calendar API sends a notification message as a POST request to that URL.
You may also check this SO thread for additional reference.
Upvotes: 2