Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

238
Vistas
Firebase initialization returning "Uncaught ReferenceError: firebase is not defined"

I have the following setup:

<button type="button" name="button" class="btn btn-danger" onclick="signIn()">
  <i class="fa fa-google"></i> &nbsp;Login With Google
</button>
<script src="js/firebase.js" type="module"></script>
<script src="js/custom.js"></script>

firebase.js

// FIREBASE INITIALIZATION
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.3.0/firebase-app.js";
import { getAnalytics } from "https://www.gstatic.com/firebasejs/9.3.0/firebase-analytics.js";
const firebaseConfig = {
  apiKey: "XXXXXXXX",
  authDomain: "fir-chat-application-3e442.firebaseapp.com",
  projectId: "fir-chat-application-3e442",
  storageBucket: "fir-chat-application-3e442.appspot.com",
  messagingSenderId: "264006913204",
  appId: "XXXXXXXX",
  measurementId: "XXXXXXXX"
};
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);

custom.js

function signIn(){
  var provider = new firebase.auth.GoogleAuthProvider();
}

When I click on the Login With Google button I am getting the following error in the console:

Uncaught ReferenceError: firebase is not defined

I checked everything again and again but I don't seem to catch the error. What mistake am I making here?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You're mixing api v8 and v9.

import { GoogleAuthProvider } from "https://www.gstatic.com/firebasejs/9.3.0/firebase-auth.js"

const provider = new GoogleAuthProvider();

Edit to demostrate that firebase scripts includes GoogleAuthProvider:

<script type="module">

import { GoogleAuthProvider } from "https://www.gstatic.com/firebasejs/9.3.0/firebase-auth.js"

console.info(GoogleAuthProvider)
</script>

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda