如何访问用户的电子邮件地址。我正在使用内置的 的 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
这是我的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: ~
答案 0 :(得分:0)
我不知道,但一年前我使用的是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"
它会向我发回电子邮件。但也许谷歌改变一些我不知道的东西,希望这会有所帮助:)