Reputation: 21
Trying to use both bundles with latest Symfony (V:2.7.2).
FOSOauth is set and works fine, but adding HWIOAuthBundle isn't so trivial. Following the instruction in native Read.me brought me to this:
How to setup this two together?
Upvotes: 2
Views: 1633
Reputation: 111
You need to add new firewall (e.g. secured_area) with authentication way "oauth".
For example:
security:
firewalls:
secured_area:
anonymous: ~
oauth:
resource_owners:
facebook: "/login/check-facebook"
google: "/login/check-google"
my_custom_provider: "/login/check-custom"
my_github: "/login/check-github"
login_path: /login
use_forward: false
failure_path: /login
oauth_user_provider:
service: my.oauth_aware.user_provider.service
You can find this info here
Upvotes: 0
Reputation: 372
It seems you haven't configured properly oauth section in the firewall (security.yml file) you want HWIOAuthBundle to work with. For example, with Facebook:
// app/config/config.yml
hwi_oauth:
firewall_name: main
resource_owners:
facebook:
type: facebook
...
Then you need to configure main firewall
// app/config/security.yml
main:
pattern: ^/
oauth:
resource_owners:
facebook: "/login/check-facebook"
oauth_user_provider:
service: my_custom_oauth_user_provider
...
Don't forget to declare facebook login-check route
// app/config/routing.yml
facebook_login:
path: /login/check-facebook
and you also need to create a user provider (the bundle itself has some built-in providers that you can extend and modify) and register it as a service
// app/config/services.yml
my_custom_oauth_user_provider:
class: AppBundle\Security\OAuthUserProvider
As your question is how to setup HWIOAuthBundle with FOSOAuthServerBundle, there is a very complete guide of how to achieve this: A way to integrate FosUserBundle and HWIOAuthBundle
Upvotes: 1