FirebaseExtended / angularfire

AngularJS bindings for Firebase

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Uncaught TypeError: Cannot read property 'GoogleAuthProvider

maryyocelotl opened this issue · comments

index.html
<body>

<h1>Inicia sesion para comprar tus boletos</h1>
<div id="contenedor">
<div id="foto"></div>
<button id="logueo">Con tu correo electrónico</button>
<div id="principal"></div>
<button id="guardar">Recordarme</button>
</div>

<script src="https://code.jquery.com/jquery-3.5.1.min.js"
integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="
crossorigin="anonymous"></script>

<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/7.14.3/firebase-app.js"></script>

<script>
// Your web app's Firebase configuration
var firebaseConfig = {
apiKey: "AIzaSyCJrT4Sitd0_SmRcbsdg_FuM7k",
authDomain: "madproject.firebaseapp.com",
databaseURL: "https://madproject.firebaseio.com",
projectId: "madproject",
storageBucket: "madproject.appspot.com",
messagingSenderId: "401737271624",
appId: "1:401737271624:web:6d9f9a6ce510b7d",
measurementId: "G-8PJVLHKKRG"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
// firebase.analytics();
</script>

<script src="app.js"></script>
</body>

app.js
ar provider = new firebase.auth.GoogleAuthProvider();
$('#logueo').click(function(){
firebase.auth()
.signInWithPopup(provider)
.then(function(result){
console.log(result.user);
almacenaDatos(result.user);
$('#logueo').hide()
$('#principal').append("<img src='"+result.user.photoURL+"'/>")
});
});

but when I click on the button logueo I get the error: Uncaught TypeError: Cannot read property 'GoogleAuthProvider'** of undefined at app.js: 1

Firebase only provides me with those snippets
Please helpp!! :(

I had to add some authentication libraries :)