Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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
like image 578
iffy Avatar asked Jun 25 '14 13:06

iffy


People also ask

How do I get Google OAuth client secret?

Get a client ID and client secretOn the Credentials page, select Create credentials, then select OAuth client ID. Under Application type, choose Web application. Click Create. On the page that appears, take note of the client ID and client secret.

How do I get my Google access token email API?

If this scope is included while you generate the refresh token, you should be able to get the email address of the authenticating user by making the following request: https://www.googleapis.com/oauth2/v2/userinfo?access_token="YOUR_ACCESS_TOKEN". You can try this out in the API explorer.


1 Answers

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.

like image 91
Owen Cao Avatar answered Oct 12 '22 17:10

Owen Cao