firebase messaging token returns null javascript -


i'm following instruction here , cannot token firebase messaging: gettoken returns null. since cannot include firebase srcipt in stackoverflow snippet, here's code:

js:

// initialize firebase var config = {     apikey: "aizasycmlkvlzbv5peluzg99hzjm0h6cqskvqwe",     authdomain: "rps-multiplayer-6e91f.firebaseapp.com",     databaseurl: "https://rps-multiplayer-6e91f.firebaseio.com",     projectid: "rps-multiplayer-6e91f",     storagebucket: "",     messagingsenderid: "879810800461" }; firebase.initializeapp(config);  var bigone = document.getelementbyid('bigone'); var dbref = firebase.database().ref().child('text'); dbref.on('value', snap => bigone.innertext = snap.val());  //firebase message const messaging = firebase.messaging();  messaging.requestpermission() .then(function() {     console.log('have permission');     return messaging.gettoken(); }) .then(function(token) {     console.log(token); }) .catch(function(err) {     console.log('error occured'); }); 

html

<body> <h1 id="bigone"></h1> 
    <script src="https://www.gstatic.com/firebasejs/4.3.0/firebase-app.js"></script>     <script src="https://www.gstatic.com/firebasejs/4.3.0/firebase-auth.js"></script>     <script src="https://www.gstatic.com/firebasejs/4.3.0/firebase-database.js"></script>     <script src="https://www.gstatic.com/firebasejs/4.3.0/firebase-messaging.js"></script>     <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> </body> 

i'm aware there's similar question, answer doesn't fit case because i'm not hosting files anywhere, files on local machine. i've tested firefox , shows "error occurred" it's not google chrome's problem.


Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -