Dav*_*les 5 oauth symfony google-plus
我们为Symfony2应用程序提供了Facebook和Twitter授权的捆绑包.但是像Google Plus这样的其他网站呢?还没有任何捆绑,我想知道是否有人知道如何实现它的正确方向.
我认为Google Plus使用OAuth.是否可以使用OAuth捆绑包实现?
不推荐使用KnpOAuthBundle,建议使用HWIOAuthBundle.
HWIOAuthBundle支持多个OAuth提供商,如Facebook,Twitter,Google,Yahoo等.因此,您可以将所有身份验证逻辑保存在一个捆绑包中.使用非常简单:配置google资源所有者:
hwi_oauth:
resource_owners:
google:
type: google
client_id: *client_id*
client_secret: *client_secret
scope: "https://www.googleapis.com/auth/plus.me https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile"
firewall_name: *main firewal name*
Run Code Online (Sandbox Code Playgroud)
并添加路线:
google_login:
pattern: /login/google
hwi_oauth_redirect:
resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
prefix: /connect
Run Code Online (Sandbox Code Playgroud)
要启动身份验证过程,只需将用户重定向到/connect/*provider_name*,例如/connect/google
您可以检查KnpOAuthBundle(正在开发中) - 但仅实现了 github OAuth 提供程序。
您可以实现自己的 Google OAuth 2.0 Provider(检查此)或在 IRC 上询问,也许有人已经实现了它。
| 归档时间: |
|
| 查看次数: |
3496 次 |
| 最近记录: |