1

How do I access the users email address. I am using the built in hwi_oauth.user.provider

What's the best way to do that?

here is my config.yml

    resource_owners:
    google:
        type:                google
        client_id:           <CLIENTID>
        client_secret:       <SECRET>
        scope:               "email profile https://spreadsheets.google.com/feeds https://www.googleapis.com/auth/plus.me https://www.googleapis.com/auth/plus.login"
        paths:
            email:           email

here is my security.yml

security:

# http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
providers:
    in_memory:
        memory: ~
    hwi:                               
        id: hwi_oauth.user.provider
firewalls:
    secured_area:           
       anonymous: ~
       oauth:
           resource_owners:                   
               google:             "/login/check-google"
           login_path:        /login
           use_forward:       false
           failure_path:      /login

           oauth_user_provider:
               service: hwi_oauth.user.provider
       logout:
           path: /logout
           target: /
    # disables authentication for assets and the profiler, adapt it according to your needs
    dev:
        pattern: ^/(_(profiler|wdt)|css|images|js)/
        security: false

    main:
        anonymous: ~

1 Answers1

0

I dont know, but one year ago I am using HWIOauth to, and my config looks like:

google:
            type:                google
            client_id:           client_id
            client_secret:       secret
            scope:               "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile"

And it returns email to me. But maybe google change something I dont know, hope this will help somehow :)

nowiko
  • 2,507
  • 6
  • 38
  • 82