I'm using hello.js to allow users to sign on my site. So far, sign in for google has worked fine, but I have a specific user who gets an error.
They have a non-gmail email address, but can usually sign in to google services with it (think "[email protected]"). When he signs in, the returned object has blank fields for several variables denoting his name ("name","last_name", "first_name", "displayName" are all blank). The result is that he gets a warm welcoming "Welcome [object Object]" message when he signs in and my application has no name info to use. Below is the code I used to implement hello.js. However, I'm confused about whether this is something wrong with my code, or the way I've set things up through the google developers console, or if it just has to do with the nature of his account.
hello.on('auth.login', function(auth) {
// Call user information, for the given network
hello(auth.network).api('/me').then(function(r) {
// Inject it into the container
$("#div" + auth.network).css('visibility', 'visible'); //reveal div where prof is displayed
$("#div" + auth.network).css("display", "block");
var label = document.getElementById('profile_' + auth.network);
label.innerHTML = '<div style="padding:10px;"><img id="profilepic" src="' + r.thumbnail + '" /><br>Welcome ' + r.name + '</div>';
console.log("Returned object from sos: ",r);
console.log(r.name," from ",auth.network);
sos = auth.network;
sos_name = r.name ;
});
});
hello.init({
facebook: FACEBOOK_CLIENT_ID,
google: GOOGLE_CLIENT_ID,
});
Below is the output from console.log when it outputs "r" above. I replaced some fields with REDACTED in case it had any sensitive info.
displayName ""
etag ""REDACTED""
first_name ""
id "REDACTED"
image Object { url="https://lh3.googleuserco...rscbv5M/photo.jpg?sz=50",
isDefault=true}
isPlusUser false
kind "plus#person"
language "en"
last_name ""
name Object { familyName="", givenName=""}
objectType "person"
picture "https://lh3.googleuserco...rscbv5M/photo.jpg?sz=50"
thumbnail "https://lh3.googleuserco...rscbv5M/photo.jpg?sz=50"
verified false
Note that I've signed in with other google accounts that have isPlusUser set to false, and they still have intact name information, so I don't think that's a red flag.