chemerisuk / cordova-plugin-firebase-messaging

Cordova plugin for Firebase Cloud Messaging
MIT License
164 stars 160 forks source link

Empty token #204

Open phiasco12 opened 2 years ago

phiasco12 commented 2 years ago

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);
});
chemerisuk commented 2 years ago

@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);
    });
});
codewithvickaiah01 commented 2 years ago
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

Daniel123454321 commented 1 year ago

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