Skip to content

Instantly share code, notes, and snippets.

@dlrust
Last active September 25, 2015 16:57
Show Gist options
  • Save dlrust/954102 to your computer and use it in GitHub Desktop.
Save dlrust/954102 to your computer and use it in GitHub Desktop.
idkit example for federatedidentity.com
<!doctype html>
<html>
<head>
<title>IDKIT javascript example</title>
</head>
<body>
<div id="idkit-root"></div>
<script src="https://www.federatedidentity.com/static/js/idkit.js"></script>
<script>
IDKIT.init({appId: '721113'});
IDKIT.getLoginStatus(function(response) {
if(response.session) {
alert(response.session.username + ' is logged in');
}
else if(response.error) {
alert(response.error);
}
else {
alert('user not logged in');
}
})
</script>
</body>
</html>
<!doctype html>
<html>
<head>
<title>IDKIT login example</title>
</head>
<body>
<div id="idkit-root"></div>
<script src="https://www.federatedidentity.com/static/js/idkit.js"></script>
<script>
IDKIT.init({appId: '721113'});
IDKIT.loginWithToken('721113.93f6d8c833072f12a775708d62c28412.1304930402');
</script>
</body>
</html>
<!doctype html>
<html>
<head>
<title>IDKIT login example</title>
</head>
<body>
<div id="idkit-root"></div>
<script src="https://www.federatedidentity.com/static/js/idkit.js"></script>
<script>
IDKIT.init({appId: '721113'});
IDKIT.logout(function() {
// Do something after the logout (i.e. redirect the user)
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment