Google+ api doesn't return profile name with login request

后端 未结 5 1185
挽巷
挽巷 2021-01-16 04:48

The google documentation HERE clearly says that

You should not request userinfo.profile or plus.me in combination with [https://www.googleapis.com/au

相关标签:
5条回答
  • 2021-01-16 05:10

    I also got into difficulty getting the profile and e-mail address. Finally I found that I can use these scopes to get everything:

    'https://www.googleapis.com/auth/plus.login', 'email', 'profile'

    0 讨论(0)
  • 2021-01-16 05:10

    Works on me this way

    scope = https://www.googleapis.com/auth/userinfo.profile email

    between userinfo.profile and email has space in it

    0 讨论(0)
  • 2021-01-16 05:11

    You need userinfo.email to get the email address, but you should be able to request that without also requesting userinfo.profile. plus.login should give you access to the "GET /plus/v1/people/{userid}" call which should return the following fields/objects (at a minimum):

    • name - an object containing the name broken down into fields
    • displayName
    • nickname
    0 讨论(0)
  • 2021-01-16 05:22

    I have achieved multi-scoping using following scope param.

    scope = https://www.googleapis.com/auth/userinfo.email+profile

    0 讨论(0)
  • 2021-01-16 05:26

    Seems like Google is a little vague in its documentation. They say the scope 'plus.login' contains the displayName and email, however, after running several tests with different Google accounts (plain Gmail, Google+, Google Apps) this seems to be false.

    If the user doesn't have a Google+ profile, 'plus.login' will NOT contain displayName. This also seems to happen to Google Apps accounts. So, to cover all possible Google Account status, the safe bet is to request for:

    • https://www.googleapis.com/auth/plus.login
    • https://www.googleapis.com/auth/plus.me
    • https://www.googleapis.com/auth/userinfo.email
    • https://www.googleapis.com/auth/userinfo.profile

    They say the last 2 are deprecated, however, some accounts will not return all basic information if you don't use them. I don't know if this is related to the "age" of the Google account or just a bug on Google's end.

    0 讨论(0)
提交回复
热议问题