令牌不是在网络上生成的..................
<!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>
这是我的代码,抱歉我无法完全显示我的 FCM 启动代码
error on my console
hello.html:29 Have permission
hello.html:33 null
hello.html:34 undefined
初始化时需要提供 API 密钥