Token is not generating on the web...........................................................................................................................
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
heloooo
</body>
</html>
<script src="https://www.gstatic.com/firebasejs/4.12.1/firebase.js"></script>
<script>
// Initialize Firebase
var config = {
apiKey: "",
authDomain: "",
databaseURL: "",
projectId: "",
storageBucket: "",
messagingSenderId: ""
};
firebase.initializeApp(config);
const messaging=firebase.messaging();
messaging.requestPermission()
.then(function() {
console.log('Have permission');
return messaging.getToken();
})
.then(function(token){
console.log(this.token);
})
.catch(function(err){
console.log('Error occured.');
})
</script>
this is my code sorry i can't show my fcm initiation code completely
error on my console
hello.html:29 Have permission
hello.html:33 null
hello.html:34 undefined
您需要在初始化时提供API密钥
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.