Reputation: 18064
We have bundles for Facebook & Twitter authorization for a Symfony2 app. But what about other sites like Google Plus? There isn't any bundle yet, and I would like to know if someone knows about the right direction to how to implement it.
I think Google Plus uses OAuth. Could it be then implemented with a OAuth bundle?
Upvotes: 5
Views: 3527
Reputation: 2856
KnpOAuthBundle is deprecated and recommends using HWIOAuthBundle.
HWIOAuthBundle supports several OAuth providers such as Facebook, Twitter, Google, Yahoo, etc. So you can keep all your authentication logic in 1 bundle. Usage is very easy: configure google resource owner:
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*
And add routings:
google_login:
pattern: /login/google
hwi_oauth_redirect:
resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
prefix: /connect
To start authentication process simply redirect user to /connect/*provider_name*
, e.g. /connect/google
Upvotes: 8
Reputation: 59086
You can check the KnpOAuthBundle (under development) - only the github OAuth provider is implemented though.
You could implemented your own Google OAuth 2.0 Provider (check this) or ask out on IRC, maybe somebody already implemented it.
Upvotes: 2