Created
April 19, 2010 22:01
-
-
Save chrismessina/371706 to your computer and use it in GitHub Desktop.
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
<script type="text/javascript"> | |
function doLogin(doneUrl) { | |
/* Tell XAuth.org that a user has just signed into Google on this browser. */ | |
XAuth.extend({ | |
// reveals "someone is logged into Google" | |
token: "1", | |
// Expires after 24 hours or if the user explicitly logs out | |
expire: new Date().getTime() + 60*60*24*1000, | |
// Allow any domain to read this info (could also be a whitelist of partners) | |
extend: ["*"], | |
// Optional callback function once extend() has completed. | |
callback: makeRedirectFunc(doneUrl) | |
}); | |
} | |
</script> | |
<script type="text/javascript"> | |
XAuth.retrieve({ | |
retrieve: ['xauth.org', 'googxauthdemo.appspot.com', 'xauthdemo.mslivelabs.com'], | |
callback: receiveTokens } | |
); | |
</script> | |
<script type="text/javascript"> | |
function receiveTokens(responseObj) { | |
var tokens = responseObj.tokens; | |
var token = tokens['xauth.org']; | |
var partners = {}; | |
var tokensFound = false; | |
if (tokens['googxauthdemo.appspot.com']) { | |
partners['google'] = true; | |
tokensFound = true; | |
var status = document.getElementById('status-google'); | |
status.innerHTML = 'Signed In!'; | |
status.style.color = '#0A0'; | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment