2

我正在尝试向 GCM 发布消息。但是发送调用失败,状态为 401。我正在传递授权标头。传递正确的 API 密钥(允许任何 IP)。我已启用云消息服务。我也尝试使用浏览器密钥代替 API 密钥(没有推荐人)

curl 请求如下所示 >

curl -v --header "Authorization:key=VALID API KEY" --header Content-Type:"application/json" https://android.googleapis.com/gcm/send -d "{\"registration_ids\": [\"r1\"]}"

POST /gcm/send HTTP/1.1
User-Agent: curl/7.24.0 (x86_64-redhat-linux-gnu) libcurl/7.24.0 NSS/3.13.5.0 zlib/1.2.5 libidn/1.18 libssh2/1.2.2

Host: android.googleapis.com

Accept: */*

Authorization:key= VALID API KEY With allow all IP

Content-Type:application/json

Content-Length: 28

似乎没有任何效果。知道为什么会这样吗?

4

0 回答 0