Skip to content

Instantly share code, notes, and snippets.

@thangman22
Created September 22, 2016 16:38
Show Gist options
  • Save thangman22/144d1874e0133d737c264cfb7ac3b1e2 to your computer and use it in GitHub Desktop.
Save thangman22/144d1874e0133d737c264cfb7ac3b1e2 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Thangman22 auth</title>
<script src="https://www.gstatic.com/firebasejs/3.4.0/firebase.js"></script>
<script>
// Initialize Firebase
var config = {
apiKey: "xxxxx",
authDomain: "thangman22-auth.firebaseapp.com",
databaseURL: "https://thangman22-auth.firebaseio.com",
storageBucket: "thangman22-auth.appspot.com",
messagingSenderId: "xxxxx"
};
firebase.initializeApp(config);
var provider = new firebase.auth.GoogleAuthProvider();
function onSignInButtonClick(){
firebase.auth().signInWithPopup(provider).then(function(result) {
console.log(result);
//Do something when login complete
}).catch(function(error) {
//Do something when error
});
}
</script>
</head>
<body>
<button onclick="onSignInButtonClick()">Login</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment