2

我們使用chcm的gcm進行擴展。我們得到了Oauth,如「ya29。* *」,並將此擴展用於開發儀表板。用於chrome 403的GCM forbbiden錯誤

我們的服務器請求發送消息到gcm並得到這個錯誤。

爲什麼鉻的gcm返回此錯誤?

{ 
"error": { 
    "errors": [ 
     { 
      "domain": "gcmForChrome.message", 
      "reason": "forbiddenForNonAppOwner", 
      "message": "A message can only be sent by the owner of the app." 
     } 
    ], 
    "code": 403, 
    "message": "A message can only be sent by the owner of the app." 
} 

我們的服務器請求是這樣的。

curl_setopt($ch, CURLOPT_URL,'https://www.googleapis.com/gcm_for_chrome/v1/messages'); 
curl_setopt($ch, CURLOPT_HTTPHEADER,$headers); 
curl_setopt($ch, CURLOPT_POST, true); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
curl_setopt($ch, CURLOPT_POSTFIELDS,json_encode($arr)); 

謝謝。

回答

1

您是否發佈的擴展?在發送推送消息之前,它必須公開(您可以發佈給受信任的測試人員)。將其上傳到開發人員儀表板是不夠的。

還要確保Chrome網上應用店和您的電腦上的擴展名ID一致(https://developer.chrome.com/extensions/cloudMessaging.html#test-cloud)。

+0

感謝您的回答,但由於此錯誤我們無法發佈。 [link](http://productforums.google.com/forum/#!topic/chrome/pkmiFvCypks) –