Created
December 18, 2013 22:49
-
-
Save ianbarber/8031221 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
function onSignIn(authResult) { | |
if (!authResult.status.signed_in) { | |
gapi.signin.render('signinbutton'); | |
} else { | |
if (authResult.scope.indexOf(YOUTUBE_SCOPE) != -1) { | |
log("User has YouTube scope"); | |
} | |
token = gapi.auth.unsafeUnpackIdToken(authResult); | |
if (lastUser === undefined) { | |
lastUser = token.sub; | |
} else if(token.sub != lastUser) { | |
log("User has chosen a page!"); | |
// Our YouTube user is a different user, so we can take | |
// appropriate action - for example sending a code to the | |
// server and indicating this should be stored separately. | |
//... | |
} | |
} | |
console.log(authResult); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment