chintan123
chintan123

Reputation: 358

unable to receive push notification for Google calender

I am trying to watch events resource based on given example using API explorer and Chrome Advanced Rest Client. https://developers.google.com/google-apps/calendar/v3/push#watch_request_examples

Requst

POST https://www.googleapis.com/calendar/v3/calendars/XXX%40gmail.com/events/watch?key={YOUR_API_KEY}

Content-Type:  application/json
Authorization:  Bearer ya29.AHES6ZSNBYiHYPu6Y1_5P08hdb-EX5pdF4Ygj5ou_RKp_jOCS5beiDDH
X-JavaScript-User-Agent:  Google APIs Explorer

{
 "id": "01234567-89ab-cdef-0123456789ab",
 "type": "web_hook",
 "address": "https://www.example.com/WebHook/Index",
 "token": "token=123546"
}

Response

401 Unauthorized



cache-control:  private, max-age=0
content-encoding:  gzip
content-length:  188
content-type:  application/json; charset=UTF-8
date:  Thu, 17 Oct 2013 12:49:00 GMT
expires:  Thu, 17 Oct 2013 12:49:00 GMT
server:  GSE
www-authenticate:  Bearer realm="https://www.google.com/accounts/AuthSubRequest", error=invalid_token

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "push.webhookUrlUnauthorized",
    "message": "Unauthorized WebHook callback channel: https://www.example.com/WebHook/Index"
   }
  ],
  "code": 401,
  "message": "Unauthorized WebHook callback channel: https://www.example.com/WebHook/Index"
 }
}

can anybody guide, whats wrong with request ?

Upvotes: 1

Views: 1549

Answers (4)

MercuryMan
MercuryMan

Reputation: 173

The one step I was missing to get this working was to actually enable the Calendar API in the console. The 401 push.webhookUrlUnauthorized error is really not helpful here.

Upvotes: 0

chintan123
chintan123

Reputation: 358

Finally It worked for me , cause of error "Unauthorized WebHook callback channel" was in Configuration of Project in

  • Go to Google Developers Console.
  • Click your project name
  • Click "API & Auth" Menu on left
  • then click on sub menu "Push"
  • Click on Add Domains button which Allows webhook notifications to be sent to the entered domains

Happy coding :)

Upvotes: -3

Addy
Addy

Reputation: 51

Your auth token may be incorrect. Please make sure you are using correct auth token for the calendar you are trying to set watch for

Upvotes: 0

Venkatesh Bachu
Venkatesh Bachu

Reputation: 2553

when you try with API Explorer,it will not use your OAuth2.0 project keys where you have registerd whitelisted domains, maybe it would use another keys

try to use client/lib

Upvotes: 0

Related Questions