Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

195
Visualizações
Firebase Cloud Messing Error : DOMException: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded

Hello i am using the Firebase with my PHP project with javascript i am getting this error when i try to retrive the FCM device token:

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.1.0/firebase-messaging.js:1:25342
at https://www.gstatic.com/firebasejs/8.1.0/firebase-messaging.js:1:25426
at https://www.gstatic.com/firebasejs/8.1.0/firebase-messaging.js:1:1982
at Object.next (https://www.gstatic.com/firebasejs/8.1.0/firebase-messaging.js:1:2087)
at r (https://www.gstatic.com/firebasejs/8.1.0/firebase-messaging.js:1:833)

Here is my code :

<script type="module">
import  "https://www.gstatic.com/firebasejs/8.1.0/firebase-app.js";
import  "https://www.gstatic.com/firebasejs/8.1.0/firebase-messaging.js";

const firebaseConfig = {
    apiKey: "************",
    authDomain: "*************",
    databaseURL: "***********",
    projectId: "*****bdb20",
    storageBucket: "*********com",
    messagingSenderId: "***************",
    appId: "**************",
    measurementId: "G-7HS1PXRZMR"
};

// Initialize Firebase
firebase.initializeApp(firebaseConfig);
const messaging = firebase.messaging();
messaging.usePublicVapidKey('**********SjpDQfr4gm6NvOmUvH2UoPCqxthqY');
messaging.getToken().then((currentToken) => {
    if (currentToken) {
        console.log(currentToken);
    } else {
    // Show permission request UI
    console.log('No registration token available. Request permission to generate one.');
    // ...
    }
}).catch((err) => {
    console.log('An error occurred while retrieving token. ', err);
    // ...
});

Can anyone resolve this?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda