如何访问用户的邮箱地址?我用的是内置的 hwi_oauth.user.provider
最好的方法是什么?
这里是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: ~
我不知道,但是一年前我正在使用HWIOauth,我的配置看起来像:
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"
它返回电子邮件给我。但也许谷歌改变了一些我不知道的东西,希望这能有所帮助:)