我正在尝试向GCM发布消息 . 但发送呼叫失败,状态为401 . 我正在传递Authorization标头 . 传递正确的API密钥(允许任何IP) . 我已启用 Cloud 消息传递服务 . 我也尝试使用浏览器密钥代替API密钥(没有引用者)
卷曲请求看起来像这样>
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
似乎没什么用 . 知道为什么会这样吗?