4
votes

Currently we are in the process of developing one iPhone application that deals with google calendar. There was need of syncing calendar events to the server side. Everything works fine.

But for push notification , we are following this process

Whenever we post request to : https://www.googleapis.com/calendar/v3/calendars/[email protected]/events/watch

with parameters

"id":Unique string ( channel id) ,  
"type": "web_hook",
"address": "https://abc-api.herokuapp.com/user/notifications"

In the header , we are sending

Authorization : **Bearer 'Access_token'** 

and content type : json

We already added domain as authorized domain in the google api console

Access_token is user's account access token .

We are getting "Unauthorized webhook call" error.

    {
  "error": {
    "errors": [
      {
        "domain": "global",
        "reason": "push.webhookUrlUnauthorized",
        "message": "Unauthorized WebHook callback channel: https://abc-api.herokuapp.com/user/notifications"
      }
    ],
    "code": 401,
    "message": "Unauthorized WebHook callback channel: https://abc-api.herokuapp.com/user/notifications"
  }
}

Anyone here who can help us to solve the issue ?

2

2 Answers

2
votes

You might want to check this post, providing solution like verifying if your domain have a valid (not self-signed) SSL license. Also in google-api-php-client GitHub, instead of setting https://example.com/google/push (resulted in Unauthorized WebHook callback channel) or https://www.example.com/google/push (allowed me to successfully open channel, and object has been returned, however webhook has not been fired) as address they tried https://www.example.com/google/push/index.php and worked.

0
votes

One potential issue is if you're testing in Google's "try it" section of the documentation. It's not stated, but this particular request does not work there.

Otherwise, there are a few things that need to happen with the domain you are supplying in the address. First, you need to make sure its verified in the google developers console for the application you are hitting the api with. Additionally, you need to add the website property to your search console (even if its just an api) and verify ownership.

Also, once you get past the unauthorized address issue, you will get another error requiring a resourceId be supplied.