Skip to content

Instantly share code, notes, and snippets.

@mckoss
Created December 4, 2015 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mckoss/1aa7aca9e3c76b1d1334 to your computer and use it in GitHub Desktop.
Save mckoss/1aa7aca9e3c76b1d1334 to your computer and use it in GitHub Desktop.
Firebase select_account option test
<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