Is there a way to *only* get a user's email address with Google's OAuth2 implementation?

风格不统一 提交于 2019-11-29 12:20:13

问题


I have a "Sign in with Google+" button on my page. When people click on it, I want the only thing they authorize to be "View your email address."

I don't want "Know who you are on Google" or "View basic information about your account." I only want their email address.

I'm playing on the OAuth 2.0 Playground (https://developers.google.com/oauthplayground/) and see this:


Scope: email

Requests:

  1. Know who you are on Google
  2. View your email address

Scope: https://www.googleapis.com/auth/userinfo.email (and this one is deprecated)

Requests:

  1. Know who you are on Google
  2. View your email address

回答1:


Indeed, I've noticed that too. And I found an explanation from February 2013 here:

This is an intentional change to more precisely communicate to users the set of permissions that is being granted. Through knowledge of the user's email address it is possible, via indirect means, to locate the user's profile address. In the interest of more accurate disclosure, thus, we are prompting users to approve such disclosure.




回答2:


Not exactly what you want, but combining profile and email will at least give one a less scary description for the first:

This app would like to:

  • View basic information about your account
  • View your email address

...with the help for the first saying:

More info

View your name, public profile URL, and photo
View your gender
View your country, language, and timezone

To me, this feels better than the vague This app is requesting permission to associate you with your public Google profile which one gets as the More Info for Know who you are on Google+, when not explicitly using scope profile, or when using scope openid.

As an aside: LinkedIn's OAuth 2 also always needs a user to grant access to Your Profile Overview, even if an application only needs some unique identifier. Other than with Google's explanation in Owen's answer, I assume LinkedIn really wants developers to use their network features.



来源:https://stackoverflow.com/questions/24410179/is-there-a-way-to-only-get-a-users-email-address-with-googles-oauth2-impleme

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!