允许用户在Symfony2中使用自己的Google帐户登录的最佳方式是什么?我知道谷歌API的工作原理。但是如何实现自定义身份验证提供程序呢?
我已经读过这个文档,但我不明白为什么我必须创建一个自定义的用户类。我想用Google API获取用户证书,测试用户电子邮件是否存在于我的bdd中,然后记录用户。
有人有主意吗?
非常感谢
我推荐HWIOAuthBundle-它支持通过许多OAuth提供程序进行身份验证,包括goodle。
谷歌使用这个捆绑包的一个快速配置示例是:
hwi_oauth:
resource_owners:
any_name:
type: google
client_id: <client_id>
client_secret: <client_secret>
scope: "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile"
其中<client_id>
和<client_secret>
是您的详细信息。