Skip to content

Instantly share code, notes, and snippets.

@ianbarber
Created December 18, 2013 22:49
Show Gist options
  • Save ianbarber/8031221 to your computer and use it in GitHub Desktop.
Save ianbarber/8031221 to your computer and use it in GitHub Desktop.
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