Auth0 Home Blog Docs

Can't get email after Google oauth2 Symfony

auth0
google
symfony

#1

So, the problem is very simple: I have all the information, but I don’t have an email. Why? I don’t understand and don’t have any idea…
I setup all the settings, and no problem with getting information and authorization, but I email doesn’t appear.
Here is example of response:

  "sub": "google-oauth2|5179471928371239766",
  "given_name": "Some name",
  "family_name": "Some Family name",
  "nickname": "some_nickname",
  "name": "Some real name",
  "picture": "https://some-google-server.com/some_picture.jpg",
  "locale": "ru",
  "updated_at": "2018-09-20T15:37:50.415Z"
}

So no email.
Can you advise me something?

Here is my config for hwi_oauth which suggest auth0 in symfony tutorial:

hwi_oauth:
    firewall_names: [main]
    resource_owners:
        auth0:
            type: oauth2
            class: 'App\Security\Auth0\ResourceOwner\Auth0ResourceOwner'
            client_id: CLIENT_ID
            client_secret: CLIENT_SECRET
            base_url: https://COMPANY.auth0.com
            redirect_uri: http://YOUR_SITE/oauth/callback
            scope: "openid profile"

Also I have add that JWT token doesn’t have email too. I just parsed the raw token and no info from it.


#2

I found the answer! Thanks for this question I found also an article in Auth0 docs we have some explanations about what is “scope”. So to get the information about email I just had to add email to my scope. So for symfony it will be

hwi_oauth:
    ...
    resource_owners:
        auth0:
            ...
            scope: "openid email profile"

I think the community should add this information in symfony tutorial (maybe not only for symfony tutorial). All other setting clearly understandable, and this setting for unprepared person don’t understandable.

But it’s my opinion, I just suggest.
I hope it will help somebody!


#3

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.