1

I have added 'Sign in with Google+' to a website, using javascript.

Using the following code

gapi.client.load('plus','v1', function(){
  var request = gapi.client.plus.people.get({
       'userId': 'me'
     });
     request.execute(function(resp) {
       console.log(resp);
     });

My HTML is this

<div id="gSignInWrapper"><div id="customBtn" class="customGPlusSignIn"> 
<span class="icon"></span> <span class="buttonText"><strong>Login</strong> with Google+</span>
</div>
</div>

I have this at the bottom of my page:

var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
       //po.src = 'https://apis.google.com/js/client:plusone.js';
       po.src = 'https://apis.google.com/js/client:plusone.js?onload=render';
       var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
     })();

function render() {
    gapi.signin.render('customBtn', {
      'callback': 'signinCallback',
      'clientid': '410303772734-t1k0lsm5f83lvrpbglgdbu71kj8gqsdv.apps.googleusercontent.com',
      'cookiepolicy': 'single_host_origin',
      'requestvisibleactions': 'http://schema.org/AddAction',
      'scope': 'https://www.googleapis.com/auth/plus.profile.emails.read'
    });`

This all creates the button and I can login ok.

The login response includes
..."emails":[{"value":"mine@gmail.com","type":"account"}], ...

The data return from Google includes an array called Emails. The array contains only the Primary email address associated with my account. How do i get all the other emails associated with the account? There are definitely other emails, I have added them today myself.

I have checked the following, but none seem to have the answer:

Community
  • 1
  • 1
Jez D
  • 1,461
  • 2
  • 25
  • 52

1 Answers1

0

The emails must be public for the user in order to appear in the API response. However, the API does not seem to be returning the email list.

The following test demo should work but I'm seeing the same as you. I'll follow up.

class
  • 8,621
  • 29
  • 30