2013-10-19 39 views
1

我正在嘗試使用API​​ Explorer和Chrome Advanced Rest Client基於給定示例觀察事件資源。 https://developers.google.com/google-apps/calendar/v3/push#watch_request_examples無法接收Google日曆的推送通知

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": "-89ab-cdef-ab", 
"type": "web_hook", 
"address": "https://www.example.com/WebHook/Index", 
"token": "token=123546" 
} 

響應

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" 
} 
} 

任何人都可以引導,最新的請求是什麼錯?

回答

0

當你與API瀏覽器試試,它不會使用,你必須registerd許可網域透過OAuth2.0項目鑰匙,也許會使用其他鍵

嘗試使用客戶端/ lib目錄

0

您的身份驗證令牌可能不正確。請確保您使用的是正確的身份驗證令牌要嘗試設置手錶

-3

最後它爲我的日曆,錯誤「未經授權的網絡掛接回調通道」的原因是在項目的配置在

  • Google Developers Console
  • 上點擊項目名稱
  • 點擊「API &驗證」菜單左
  • 然後點擊子菜單中的「推」
  • 單擊添加域按鈕,它允許網絡掛接將通知 發送到輸入域

編碼愉快:)

0

的一個步驟我失蹤得到這個工作是真正能夠在控制檯中的日曆API。 401 push.webhookUrlUnauthorized錯誤在這裏確實沒有幫助。