I'm having trouble sending a message to Google Cloud Messaging using the Node app. I created an API key (both server and browser), I am included in the white server of the IP server and by code
var headers = [
'Content-Type: application/json',
'Authorization: key=' + apiKey
];
curl("https://android.googleapis.com/gcm/send", {
HTTPHEADER: headers,
POST: true,
POSTFIELDS: JSON.stringify({
data: {
type: 'xxx',
city: 'xxx',
url: 'xxx'
},
registration_ids: [phoneId]
})
}, function () {
console.log(arguments);
});
I am trying to send a simple notification to an Android device. Sorry, I got 401 Unauthorized error . I use the library node-curl, I tried before node-gcmand node-gcm-service- both with the same result. Is there a chance that I missed?
Thanks in advance for your help, Dawid.
source
share