Today i will create a login authentication with Google firebase in Javascript it is very easy with freebase to create login authentication, register, Google Sign-in ,Facebook Login ,Twitter and GitHub, Phone number, Custom Auth System ,Anonymous Authentication , Passing State in Email Actions anything we want to create.To create authentication with firebase you have to create a account or you can your gmail account and then create no sequel database and get the details of database like i have in my html document.
Demo
JavaScript of App
firebase.auth().onAuthStateChanged(function(user) {
if (user) {
console.log('login')
$('#modal1').closeModal();
var user = firebase.auth().currentUser;
if (user != null) {
user = user.email
document.getElementById('profile').textContent = user;
$('.light-blue').css('display','block');
}
$('.light-blue').show()
} else {
$("#modal1").openModal({
dismissible: false,
opacity: 1
})
$('.light-blue').hide();
}
});
document.getElementById('logOut').addEventListener('click', function() {
firebase.auth().signOut().then(function() {
alert('Are you sure you want to log Out?');
}, function(error) {
Materialize.toast(error.message, 4000)
});
})
document.getElementById('login').addEventListener('click', function() {
var email, password;
email = document.getElementById('email').value;
password = document.getElementById('password').value;
if (email != '' && password != '') {
firebase.auth().signInWithEmailAndPassword(email, password).catch(function(error) {
Materialize.toast(error.message, 4000)
Materialize.toast('Register First to login.', 4000);
});
} else {
Materialize.toast('All fields are required for login.', 4000);
Materialize.toast('Register First to login.', 4000);
}
})
document.getElementById('register').addEventListener('click', function() {
var email, password;
email = document.getElementById('email').value;
password = document.getElementById('password').value;
if (email != '' && password != '') {
firebase.auth().createUserWithEmailAndPassword(email, password).catch(function(error) {
Materialize.toast(error.message, 4000)
});
} else {
Materialize.toast('All fields are required for registeration.', 4000);
}
})
HTML of Application
<html>
<head>
<title>The Materialize Dialogs Example</title>
<meta name = "viewport" content = "width = device-width, initial-scale = 1">
<link rel = "stylesheet" href = "https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css">
<style>
.lean-overlay{
background-color:#fff;
z-index: 999;
}
.loader {
position: absolute;
top :0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
}
</style>
<script type = "text/javascript" src = "https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src = "https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js"></script>
<script src="https://www.gstatic.com/firebasejs/4.10.1/firebase.js"></script>
<script>
$(window).load(function() {
$(".preloader-wrapper").fadeOut();
});
</script>
</head>
<body>
<div class="preloader-wrapper big loader active">
<div class="spinner-layer spinner-blue-only">
<div class="circle-clipper left">
<div class="circle"></div>
</div><div class="gap-patch">
<div class="circle"></div>
</div><div class="circle-clipper right">
<div class="circle"></div>
</div>
</div>
</div>
<nav class="light-blue lighten-1" style="display:none;" role="navigation">
<div class="nav-wrapper container">Demo
<ul class="right hide-on-med-and-down">
<li id="profile"></li>
<li>Log Out</li>
</ul>
</div>
</nav>
<div id="modal1" class="modal">
<div class="modal-content">
<div class="row">
<form class="col s12">
<div class="row">
<div class="input-field col s12">
<input id="email" type="email" class="validate">
<label for="email">Email</label>
</div>
</div>
<div class="row">
<div class="input-field col s12">
<input id="password" type="password" class="validate">
<label for="password">Password</label>
</div>
</div>
</form>
</div>
</div>
<div class="modal-footer">
lockRegister
lockLog In
</div>
</div>
<script>
// Initialize Firebase
var config = {
apiKey: "AIzaSyDHuWFreKpp1rCx9PoNJsxaJ02JURMihWE",
authDomain: "authtest-e03e4.firebaseapp.com",
databaseURL: "https://authtest-e03e4.firebaseio.com",
projectId: "authtest-e03e4",
storageBucket: "authtest-e03e4.appspot.com",
messagingSenderId: "394185954740"
};
firebase.initializeApp(config);
</script>
<script src="app.js">
</script>
</body>
</html>
glenwhy b9c45beda1 https://coub.com/stories/2730115-avenir-complete-family-pack-top-free-download-zip
philjab b9c45beda1 https://coub.com/stories/2714132-hello-neighbor-alpha-1-free-download-verified
belvkhar b9c45beda1 https://coub.com/stories/2697618-guns-germs-and-steel-episode-2-conquest-worksheet-answers-takaidel
carkam 79a0ff67a5 https://coub.com/stories/2797882-rrsrrr-r-php-ryo-mysql-maltea
vassrenn 79a0ff67a5 https://coub.com/stories/2614076-val-s-on-first-movie-in-italian-free-new-download
worcas ba0249fdb3 https://wakelet.com/wake/6pjdpbuBN_CH-eFQdU0yz
rawlwesy 7383628160 https://www.cloudschool.org/activities/ahFzfmNsb3Vkc2Nob29sLWFwcHI5CxIEVXNlchiAgMDg5dDDCgwLEgZDb3Vyc2UYgIDAkNOGwgsMCxIIQWN0aXZpdHkYgIDAsKWGoQgMogEQNTcyODg4NTg4Mjc0ODkyOA
illnoel 7383628160 https://www.cloudschool.org/activities/ahFzfmNsb3Vkc2Nob29sLWFwcHI5CxIEVXNlchiAgMDA4IHGCQwLEgZDb3Vyc2UYgIDAoOnN1goMCxIIQWN0aXZpdHkYgIDAkJnwigkMogEQNTcyODg4NTg4Mjc0ODkyOA
karefilb 7383628160 https://coub.com/stories/3024317-unilabcoils65rapidshare
sabrfin fe98829e30 https://coub.com/stories/2935887-autodesk-2013-keygen-xforce-password-updated
valatyan fe98829e30 https://coub.com/stories/3084804-download-ebook-farmakologi-dan-terapi-edisi-5-6-ohainve
rancris fe98829e30 https://www.cloudschool.org/activities/ahFzfmNsb3Vkc2Nob29sLWFwcHI5CxIEVXNlchiAgMCAgcuXCwwLEgZDb3Vyc2UYgICAn8uP-QsMCxIIQWN0aXZpdHkYgIDAkPj3tAsMogEQNTcyODg4NTg4Mjc0ODkyOA
hamosh fe98829e30 https://coub.com/stories/2943421-facebook-emoticons-chat-shortcut-keys-symbols-upd
yelnol fe98829e30 https://wakelet.com/wake/7Mh1LSYW0wQUozT5_8DH_
revejeb fe98829e30 https://www.cloudschool.org/activities/ahFzfmNsb3Vkc2Nob29sLWFwcHI5CxIEVXNlchiAgID_-N_nCgwLEgZDb3Vyc2UYgICA38nytwkMCxIIQWN0aXZpdHkYgIDA4J-WgwgMogEQNTcyODg4NTg4Mjc0ODkyOA
laurhal fe98829e30 https://wakelet.com/wake/wy8POwN94sBwnt_LhKqhr
venerey fe98829e30 https://coub.com/stories/3042352-luminosity-link-1-1-0-0-crack-updateded-by-alcatraz3222
benelle fe98829e30 https://wakelet.com/wake/e0IqCzYL0Y1PfLyNuo8LI
tanyan d868ddde6e https://coub.com/stories/3090601-merant-3-60-32-bit-progress-sql92-odbc-driver-download-full
saxtkai d868ddde6e https://coub.com/stories/3126916-you-may-ask-yourself-3rd-edition-pdf-hot
lisaphy d868ddde6e https://coub.com/stories/3065635-akordi-za-klavijature-pdf-78
sagadist d868ddde6e https://coub.com/stories/3104327-write-at-command-station-v104rar-odiastr
ligyess d868ddde6e https://coub.com/stories/3040330-exclusive-chota-bheem-vs-aliens-cricket-full-movie-free-download
sigalb d868ddde6e https://coub.com/stories/3058686-chef-in-hindi-720p-extra-quality
birqui d868ddde6e https://coub.com/stories/3096620-esr-senha-3-0-download-patched-baixaki
keichar d868ddde6e https://coub.com/stories/3000692-epopeea-lui-ghilgames-carte-pdf-download-verified
lysagil d868ddde6e https://coub.com/stories/3006629-navneetschoolatlaspdfdownload-exclusive
santcah d868ddde6e https://coub.com/stories/3127167-zte-hsupa-usb-stick-7-2-mf190-unlock-software-free-download-jorpend
wilvant d868ddde6e https://coub.com/stories/3027158-mega-pack-plugins-vst-marrwes
luyray d868ddde6e https://coub.com/stories/2944068-36-china-town-movie-in-hindi-hd-download-utorrent-movies-engldem
haleelee d868ddde6e https://coub.com/stories/3076844-thomson-tg782-firmware-update-larcha
haleelee d868ddde6e https://coub.com/stories/3076844-thomson-tg782-firmware-update-larcha
feamar d868ddde6e https://coub.com/stories/2944123-flightradar24-premium-crack-pc-speedl-laranine
denbam d868ddde6e https://coub.com/stories/3061707-fordiag-v1-22-torrent
delgila d868ddde6e https://coub.com/stories/3124075-better-vas-pc-v19-01-01-english-torrent
laqrowe d868ddde6e https://coub.com/stories/3029789-milf-hunter-cardiovaginal-brianna-velezac
vantyil b7f02f1a74 https://webbmagda90.wixsite.com/deetovesne/post/billy-joel-the-complete-albums-collection-rar
ransengl b7f02f1a74 https://oxaccreakarbow.wixsite.com/sautratonna/post/windows-guiamagicapracticafernan-full-version-software-x64
aprleas c0c125f966 https://searmerare1989.wixsite.com/tolaredde/post/ford-f150-alarm-system
kailfir fb158acf10 https://lautymasthocon.wixsite.com/righnumsetpmaz/post/what-does-active-issues-mean-on-unemployment-claim-latest-windows-64bit-key-rar-serial-utorrent
martho fb158acf10 https://kingthizchapame.wixsite.com/naithekendco/post/useless-avi
illvyta f4bc01c98b https://coub.com/stories/3224337-raju-chacha-movie-in-hindi-torrent-download-ramdan
arcioa f4bc01c98b https://coub.com/stories/3347081-2011-download-free-fastgsm-bcm-1-0-0-5-upd
chrjav f4bc01c98b https://coub.com/stories/3490398-ample-sound-agt-new-keygen-torrent
cherell f4bc01c98b https://coub.com/stories/3319110-exclusive-feto-nun-himmet-paralar-n-nas-l-kac-rd-g-masak-raporunda
bailhend f4bc01c98b https://coub.com/stories/3434910-solucionario-lengua-y-literatura-santillana-2-eso-la-casa-del-saber-grazalema-rar-wanicla
ilangeo f4bc01c98b https://coub.com/stories/3255728-free-download-full-movie-prague-in-hindi-frebri
kalosaha f4bc01c98b https://coub.com/stories/3456369-a-brief-history-of-time-in-hindi-pdf-free-download-link