Search code examples
javascriptgoogle-app-enginegoogle-signin

Getting user name and email from Google Login


I am honestly confused. This is for a commercial product and my app permissions list their name and email as part of the google sign in. My users very much want to give me their name and email, I am just adding Google Login to make it easier for them to do so per user request.

My code is just from here: https://developers.google.com/+/web/people/.

I am trying to let users login to my site with Google and to then read their name and email to store in my account database.

Currently the login is working correctly (I can log in and am writing my login token, client_id etc to the console) but when I try and request the email/name I get an error:

Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.

I have created an app here https://console.developers.google.com, got my client_id set the allowed origin, etc and I set a logo and such that I see when I click the sign in button so I believe it is correctly identifying my account when the sign in button is clicked.

My code to request the user profile data is below

function _onGoogleLogin(){
  gapi.client.load('plus', 'v1', function(){
    gapi.client.plus.people.get({userId: 'me'}).execute(handleGoogleUserDataResponse);        
  });                                                                                         
  function handleGoogleUserDataResponse(resp) {                                               
    console.log("google user data", resp);                                                    
  }
}

Do I need a paid account on the Google Developer platform to access this information more than once or twice a day? That seems insane. I am using Facebook login already and with FB the process was trivially simple and free.

I assume I am doing something stupid wrong. Do I need to separately give my client_id to gapi or something? Currently I just have this for the signin button per their documentation.

<meta name="google-signin-clientid" content="CLIENT_ID" />

Any help would be appreciated, thanks!


Solution

  • The issue is that users are being signed out immediately. This is due to a known bug in the google login system, more details are here:

    G+ Login Immediately Logs Me out 3x Using g-signin Button

    This is exactly the behavior I am encountering.