Problemas con GoogleAuthProvider(); - Problems with GoogleAuthProvider ();

1,217 views
Skip to first unread message

Anderson Viviel

unread,
Feb 25, 2020, 10:06:30 AM2/25/20
to Firebase Google Group
Hola que tal, soy nuevo en programación, nuevo en Firebase, y estoy creando una app para servicios de domicilio, comencé creando un titulo y un botón de inicio de sesión como lo explican en este video (https://www.youtube.com/watch?v=e6aoUnLQBAw), pero cuando le doy iniciar sesión, sale este error "Uncaught TypeError: Cannot read property 'GoogleAuthProvider' of undefined
    at app.js:2".

Alguien podría guiarme en el extenso mundo de firebase para lograr mi meta.


Hi, how are you, I'm new to programming, new to Firebase, and I'm creating an app for home services, I started creating a title and a login button as explained in this video (https://www.youtube.com / watch? v = e6aoUnLQBAw), but when I log in, this error comes out "Uncaught TypeError: Cannot read property 'GoogleAuthProvider' of undefined
     at app.js: 2 ".

Someone could guide me in the vast world of firebase to achieve my goal.


Index.html

<!DOCTYPE html>
<html>
<head>
<title>Mi app</title>
</head>
<body>
<h1>Inicia sesión</h1>
<button id="login">
Inicia con Google
</button>
<div id="root"></div>

<script
  integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
  crossorigin="anonymous"></script>

<!-- The core Firebase JS SDK is always required and must be listed first -->

<!-- TODO: Add SDKs for Firebase products that you want to use

<script>
  // Your web app's Firebase configuration
  var firebaseConfig = {
    apiKey: "AIzaSyD0vTddupWWTdgarT0f51zMhBN_gs1fVKQ",
    authDomain: "manicure-74e82.firebaseapp.com",
    projectId: "manicure-74e82",
    storageBucket: "manicure-74e82.appspot.com",
    messagingSenderId: "150608947733",
    appId: "1:150608947733:web:d7ba49832bdce127f17c1c",
    measurementId: "G-LJ23HB8BNQ"
  };
  // Initialize Firebase
  firebase.initializeApp(firebaseConfig);
  firebase.analytics();
</script>

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

</body>
</html>


Código App.js


//login
var provider = new firebase.auth.GoogleAuthProvider();

$('#login').click(function(){
firebase.auth()
.signInWithPopup(provider)
.then(function(result) {
var credential = firebase.auth.GoogleAuthProvider.credential(
googleUser.getAuthResponse().id_token);
firebase.auth().signInWithCredential(credential)
console.log(result.user);
});

});

Sam Stern

unread,
Feb 25, 2020, 11:50:22 AM2/25/20
to Firebase Google Group
Hi Anderson,

Do you have the Firebase Auth SDK included?  I see this in your code:

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

<!-- TODO: Add SDKs for Firebase products that you want to use
     https://firebase.google.com/docs/web/setup#available-libraries -->
<script src="https://www.gstatic.com/firebasejs/7.9.1/firebase-analytics.js"></script>


Try adding this <script> tag as well:
<script src="https://www.gstatic.com/firebasejs/7.9.1/firebase-auth.js"></script>

- Sam

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/e4d1a356-eff9-4900-8b3f-cf1c8b577a7a%40googlegroups.com.

Anderson Viviel

unread,
Feb 27, 2020, 10:56:11 PM2/27/20
to Firebase Google Group
I copied an Auth code, but I don't know very well if that works. I searched the internet but I could not, sometimes I think it is a plugin that installs in the browser does not let me see the progress, and is the same as taught in the video.
To unsubscribe from this group and stop receiving emails from it, send an email to fireba...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages