Ошибка при генерации токена FCM с помощью django
Это ошибка, которую я получаю в консоли javascript
An error occurred while retrieving token. DOMException: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.
at https://www.gstatic.com/firebasejs/8.6.3/firebase-messaging.js:1:25606
Я пытаюсь отправить push-уведомление из firebase, но получаю ошибку. кто-нибудь, пожалуйста, помогите мне. я пытаюсь сгенерировать токен FCM в консоли javascript, но получаю ошибку
вот мой файл index.html, где я получаю ошибку импорта
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://www.gstatic.com/firebasejs/8.6.3/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.6.3/firebase-analytics.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.6.3/firebase-messaging.js"></script>
{% comment %} <script src="/static/js/firebase-messaging-sw.js"> {% endcomment %}
<script>
var firebaseConfig = {
apiKey: "AIzaSyAcV-zkELH2kC2ylNcqfxcAF9LLmyJW3n8",
authDomain: "fir-push-notification-ca088.firebaseapp.com",
databaseURL: "https://fir-push-notification-ca088-default-rtdb.firebaseio.com",
projectId: "fir-push-notification-ca088",
storageBucket: "fir-push-notification-ca088.appspot.com",
messagingSenderId: "123105123891",
appId: "1:123105123891:web:59c426864dd7b8c35ecd46",
measurementId: "G-NEZ3NC2GYL"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
firebase.analytics();
const messaging = firebase.messaging();
console.log(messaging.getToken())
messaging.getToken({ vapidKey: 'AAAAHKmjHjM:APA91bEWX1Mrp6HIfjx6Y4n2chW2GpfB3GzrwQp1T1KQ3i5a_4mVnEhEa_hd95c-N9ZADi8fTUobdhlvs5d0b1JMrYWE_sJ1KjsdnXLMg4rxOAFPem4nxpazNtimZEb2PGKtHZAB9sKX' }).then((currentToken) => {
if (currentToken) {
console.log(currentToken)
} else {
console.log('No registration token available. Request permission to generate one.');
}
}).catch((err) => {
console.log('An error occurred while retrieving token. ', err);
});
messaging
.requestPermission()
.then(function () {
console.log("Notification permission granted.");
return messaging.getToken()
})
.catch(function (err) {
console.log("Unable to get permission to notify.", err);
});
messaging.onMessage((payload) => {
console.log('Message received. ', payload);
});
</script>
</head>
<body>
</body>
</html>
Кто-нибудь помогите я застрял