$().ready(function(){ // function userValid(){ // var _isvalid = false; // $.ajax({ // 'url' : '/login', // 'method' : 'POST', // 'async' : 'false', // 'data' : $('#f2').serialize(), // success: function(response){ _isvalid= true; $('.divLogout').css('margin-top','0px'); $('.divNoAut').hide(); $('.divLogout').show(); iniciar(); getregion(); // }, // statusCode:{ // 500: function(responseError){ // $('.titPrin').html(responseError['responseJSON']['error']); // $('.divNoAut').show(); // //$('.divLogout').show(); // }, // 401: function(responseError){ // $('.titPrin').html('-'); // $('.divNoAut').show(); // //$('.divLogout').show(); // } // } // }); // return _isvalid; // } //authDomain: "proy-vsp-sae-v15.firebaseapp.com", //Firebase configuration // var firebaseConfig = { // apiKey: "AIzaSyD2rX-PASC-9VpG9_ZxjEgt9-njCtvmdDU", // authDomain: "proy-vsp-sae-v15.firebaseapp.com", // databaseURL: "https://proy-vsp-sae-v15.firebaseio.com", // projectId: "proy-vsp-sae-v15", // storageBucket: "proy-vsp-sae-v15.appspot.com", // messagingSenderId: "881169368691", // appId: "1:881169368691:web:d68be7be14baaa9d6d8c06" // } // Initialize Firebase // firebase.initializeApp(firebaseConfig); // // Listening for auth state changes. // // [START authstatelistener] // //alert(user); // firebase.auth().onAuthStateChanged(function(user) { // if (user) { // $('#user').val(user.email); // //console.log(user.photoURL); // userValid(); // user.getIdToken().then(function(idToken) { // $('#tokenID').val(idToken); // }); // $('#imgprof').attr('src',user.photoURL); // $('#nameProf').html(user.displayName); // $('.divLogout').show(); // } else { // // User is signed out. // $('#user').val('x'); // $('#tokenID').val('x'); // var provider = new firebase.auth.GoogleAuthProvider(); // provider.setCustomParameters({ // prompt: 'select_account' // }); // // firebase.auth().signInWithRedirect(provider); // firebase.auth().signInWithPopup(provider).then((result) => { // // This gives you a Google Access Token. You can use it to access the Google API. // // const credential = firebase.auth().GoogleAuthProvider().credentialFromResult(result); // // const token = credential.accessToken; // // // The signed-in user info. // // const user = result.user; // // IdP data available using getAdditionalUserInfo(result) // // ... // }).catch((error) => { // // Handle Errors here. // // const errorCode = error.code; // // const errorMessage = error.message; // // // The email of the user's account used. // // const email = error.customData.email; // // // The AuthCredential type that was used. // // const credential = GoogleAuthProvider.credentialFromError(error); // // ... // }); // } // }); $('#closeSession').click(function(){ firebase.auth().signOut(); }); });