cordova-plugin-firebase-messaging icon indicating copy to clipboard operation
cordova-plugin-firebase-messaging copied to clipboard

Empty token

Open phiasco12 opened this issue 3 years ago • 3 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 avatar Feb 15 '22 09:02 phiasco12

@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);
    });
});

chemerisuk avatar Apr 19 '22 07:04 chemerisuk

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

codewithvickaiah01 avatar May 19 '22 07:05 codewithvickaiah01

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

Daniel123454321 avatar Dec 08 '22 18:12 Daniel123454321