Skip to content

Instantly share code, notes, and snippets.

@silvolu
Last active December 14, 2015 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save silvolu/5113766 to your computer and use it in GitHub Desktop.
Save silvolu/5113766 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
(function() {
var po = document.createElement('script');
po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/client:plusone.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(po, s);
})();
function signinCallback(authResult) {
if (authResult['access_token']) {
console.log(gapi.auth.getToken());
gapi.client.load('oauth2', 'v1', function() {
gapi.client.oauth2.userinfo.get().execute(function(resp) {
console.log(resp);
});
});
} else if (authResult['error']) {
console.log('There was an error: ' + authResult['error']);
}
}
</script>
</head>
<body>
<span
class="g-signin"
data-callback="signinCallback"
data-clientid="CLIENT_ID"
data-cookiepolicy="single_host_origin"
data-requestvisibleactions="http://schemas.google.com/AddActivity"
data-scope="https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/devstorage.read_only">
</span>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment