Created
July 29, 2013 14:20
-
-
Save ianbarber/6104617 to your computer and use it in GitHub Desktop.
Check Session State example
This file contains 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> | |
<title>checkSessionState Example</title> | |
<script> | |
(function() { | |
var po = document.createElement('script'); | |
po.type = 'text/javascript'; po.async = true; | |
po.src = 'https://apis.google.com/js/client:plusone.js?onload=OnLoadCallback'; | |
var s = document.getElementsByTagName('script')[0]; | |
s.parentNode.insertBefore(po, s); | |
})(); | |
function OnLoadCallback() { | |
sessionParams = { | |
'client_id': 'YOUR_CLIENT_ID_HERE', | |
'session_state': null | |
}; | |
gapi.auth.checkSessionState(sessionParams, function(stateMatched) { | |
if (stateMatched == true) { | |
document.getElementById("msg").textContent = "You be logged out"; | |
} else { | |
document.getElementById("msg").textContent = "You be logged in"; | |
} | |
}); | |
} | |
</script> | |
</head> | |
<body> | |
<div id="msg"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment