Created
December 4, 2015 20:41
-
-
Save mckoss/1aa7aca9e3c76b1d1334 to your computer and use it in GitHub Desktop.
Firebase select_account option test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="https://cdn.firebase.com/js/client/2.3.2/firebase.js"></script> | |
</head> | |
<body> | |
<input type="button" onClick="signIn()" value="Sign In"> | |
<div id="output"></div> | |
<script> | |
var ref; | |
window.addEventListener('load', init); | |
function init() { | |
log("window init"); | |
ref = new Firebase("https://koss-testing.firebaseio.com/"); | |
ref.onAuth(function(auth) { | |
log("auth: " + JSON.stringify(auth, null, 2)); | |
}); | |
} | |
function signIn() { | |
log("sign in"); | |
ref.unauth(); | |
ref.authWithOAuthRedirect("google", function(error) { | |
console.log("Error: ", error); | |
}, { | |
scope: "profile,email", | |
prompt: "select_account" | |
}); | |
} | |
function log(s) { | |
var d = document.getElementById('output'); | |
var l = document.createElement('pre'); | |
l.textContent = s; | |
d.appendChild(l); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment