chemerisuk / cordova-plugin-firebase-messaging

Cordova plugin for Firebase Cloud Messaging

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Empty token

phiasco12 opened this issue · comments

Hi,

When I run this code in iOS, I get the permission request and when I allow it, I get the alert(Device Token ) And there's no token!

I get no errors at all to indicate any issues!

this is the code:

cordova.plugins.firebase.messaging.requestPermission().then(function() {

});

cordova.plugins.firebase.messaging.getToken().then(function(token) {
    alert("Device token", token);
}).catch(function(error){
    alert(error.message);
});

@phiasco12 Try this code instead

cordova.plugins.firebase.messaging.requestPermission().then(function() {
    cordova.plugins.firebase.messaging.getToken().then(function(token) {
        alert("Device token", token);
    }).catch(function(error){
        alert(error.message);
    });
});
cordova.plugins.firebase.messaging.requestPermission().then(function() {
    cordova.plugins.firebase.messaging.getToken().then(function(token) {
        alert("Device token", token);
    }).catch(function(error){
        alert(error.message);
    });
});

@chemerisuk, I tried these codes but still getting empty token, please help out

Any success here? I've the same problem catch is never triggered since the string is returned empty.