Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save pasza01/3441bbd690ad936af770d3f3315be8dc to your computer and use it in GitHub Desktop.
Save pasza01/3441bbd690ad936af770d3f3315be8dc to your computer and use it in GitHub Desktop.
function APNStoFCM(token) {
var body = {
application : 'com.your.app',
sandbox : true,
apns_tokens : [
token
]
};
var options = {
method: "POST",
headers: {
'Accept': 'application/json',
"Content-type": "application/json; charset=UTF-8",
'Authorization' : 'key=your_key'
},
body: JSON.stringify(body)
}
fetch("https://iid.googleapis.com/iid/v1:batchImport", options)
.then(function(response) {
return response.json();
}).then(function(response) {
console.log("Prueba " + JSON.stringify(response))
}).catch(function(error) {
console.log("Error " + JSON.stringify(error))
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment