oauth 2.0 - second step in creating google plus login button -


i'm having page google+ sign in button in page www.mawk3y.net/glogin , here's code head code :

<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']) {   alert("done"); // authorized // hide sign-in button user authorized, example: document.getelementbyid('signinbutton').setattribute('style', 'display: none'); } else if (authresult['error']) { // there error. // possible error codes: //   "access_denied" - user denied access app //   "immediate_failed" - not automatically log in user // console.log('there error: ' + authresult['error']); } }  </script> 

body code:

<span id="signinbutton"> <span class="g-signin" data-callback="signincallback" data-clientid="451331211615.apps.googleusercontent.com" data-cookiepolicy="single_host_origin" data-requestvisibleactions="http://schemas.google.com/addactivity" data-scope="https://www.googleapis.com/auth/plus.login"> </span> </span> 

still important part how retrieve user information google name,email,gender,country please ?

once have authenticated user, , have authorized information them, can make calls information using plus.people.get method, or other related methods. see https://developers.google.com/+/web/people/ overview , links more detailed information.

specifically, can see code fragment @ https://developers.google.com/+/web/people/#retrieve_profile_information retrieve of person's public data except email address. typically, call fragment part of loginfinishedcallback (shown further down on page) once have verified authentication good.


Comments