GitHub oauth doesn't fetch email with scope set to "user:email,read:user"

533 Views Asked by At

I was following this tutorial to implement authorization with github using Spring. Here is oauth2 configuration:

github:
    clientId: ${GITHUB_CLIENT_ID}
    clientSecret: ${GITHUB_CLIENT_SECRET}
    redirectUri: "{baseUrl}/oauth2/callback/{registrationId}"
    scope:
       - read:user
       - user:email

To fetch profile data app sends request to https://github.com/login/oauth/authorize with following parameters:

  • response_type: code
  • scope: read:user user:email
  • client_id: <client_id>
  • state:
  • redirect_url:

The problem is that github fetches only public data (as though it ignores scope "user:email")

0

There are 0 best solutions below