Firebase Cloud Messaging Server api is giving preflight error
$http({
method: 'POST',
url: 'https://fcm.googleapis.com/fcm/send',
headers: {
'Content-Type': 'application/json',
'Authorization': 'key=AIzaSyAZ-uI5....'
},
data: notificationData
}).then(function successCallback(response) {
console.log('notification sent')
}, function errorCallback(response) {
console.log('failed to send notification')
});
var notificationData = {
"to": "dR3179CIBdk:APA91bGqvNV0a9x0khUn2rX3c403CsezB9UjPyVsmnGQXMsxruo7r8N2lravIhx6lTG_FLXwXRposoxxcSpb5Rnj84lN0o2B-a2_tzxWkdc40HlEb0kNVC25Y3V3-d2c6WUHOeNo3_UM",
"data": {
"productid": '57039b3ae4b07b473966ec8c',
"title": "Off Upto 70% hello.com",
"flashSaleId": "58c2ae6038d991a47c27asdw"
},
"notification": {
"sound": "default",
"title": "Off Upto 70% Olivetheory.com",
"body": "Heavy Discounts on betsheets,Chairs,Beds,Pillows"
}
}
Ugly preflight ERROR
XMLHttpRequest cannot load https://fcm.googleapis.com/fcm/send. Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Credentials' header in the response is '' which must be 'true' when the request's credentials mode is 'include'. Origin 'http://localhost:8080' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.
Note : I dont want to disable chrome security.
Don't know what wrong i am doing