Skip to content

Instantly share code, notes, and snippets.

@toopay
Last active October 3, 2016 07:53
Show Gist options
  • Save toopay/c625651e52a8348d7db256d3cc3fb6a5 to your computer and use it in GitHub Desktop.
Save toopay/c625651e52a8348d7db256d3cc3fb6a5 to your computer and use it in GitHub Desktop.
BixBox SDK Example
<html>
<head>
<title>SDK Test</title>
</head>
<body>
<div style="display:inline;"><bixbox:login onlogin="check" size="large"></bixbox:login></div>
<script>
function check() {
bixbox.check(function(response) {
statusCallback(response);
});
}
function statusCallback(state) {
if (state.status === 'connected') {
console.info("You are logged in!")
// Auto-logout after login
// setTimeout(function(){
// bixbox.logout(function(){
// window.location.reload()
// })
// }, 1000)
} else {
console.warn("You are not logged in!")
}
}
window.bixboxAsyncReady = function() {
// Manual invocation
// bixbox.login(function(response){
// statusCallback(response)
// })
};
(function(d, s, id){
var js, bjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.bixboxapptest.com/r.js";
js.setAttribute('data-main', '//connect.bixboxapptest.com/sdk.js');
bjs.parentNode.insertBefore(js, bjs);
}(document, 'script', 'bixbox-jssdk'));
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment