Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty token #204

Open
phiasco12 opened this issue Feb 15, 2022 · 3 comments
Open

Empty token #204

phiasco12 opened this issue Feb 15, 2022 · 3 comments

Comments

@phiasco12
Copy link

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
Copy link
Owner

@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
Copy link

codewithvickaiah01 commented May 19, 2022

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants