0

I am working on login system where user is logged to website using google plus api . I am hitting "me" endpoint after token verification .But I am facing a problem in some cases where I don't get the displayName/Name object of the user . scopes used : plus.profile and plus.login Endpint hit : "me"

$service=new Google_Service_Plus($client);
    $userinfo=$service->people->get('me');

I want to fetch the username of the user .

6
  • Is it consistent with specific users? Can you replicate it with the APIs Explorer? Are you sure you are not getting some error with the request that you are not catching? Commented Feb 7, 2015 at 19:05
  • @abraham: Yes , I am not even getting the result in API explorer . Problem is that i am getting displayName for some accounts and not for others . Is there any way to compel user for making a google plus account if he already do not have one . Commented Feb 8, 2015 at 18:33
  • I am getting blank names for those who are not google plus users . Is there any way to ask user to make a google plus account before signing into the application . Commented Feb 8, 2015 at 18:51
  • What scopes are you asking for during the sign-in flow? Commented Feb 8, 2015 at 19:31
  • I am using plus.email and plus.profile scopes . I think I need to use deprecated userinfo.email and userinfo.profile scopes in order to compel user to make a new google plus profile if his gmail account is not linked to google plus account . Commented Feb 9, 2015 at 6:29

2 Answers 2

1

Google+ Sign-In provides support for all users with a Google account, even if they have not yet created a Google+ profile. Your app can either prompt those users to create a Google+ profile (by using the https://www.googleapis.com/auth/plus.login scope) or not (by using the profile scope)

Switch to Google+ Sign-In

If you use the https://www.googleapis.com/auth/plus.login scope, users are guaranteed to have a Google+ profile.

Sign up to request clarification or add additional context in comments.

Comments

0

If you want to bring information about the profile (Names) and Email.

I'd recommed you add the follow scopes separated by two spaces:

profile  email

profile bring the Names (givenName, familyName, etc.) and email bring the email.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.