How to configure FOSUserBundle to be the authentication provider for my FOSOAuthServerBundle enabled server
You should have the following in your config.yml
fos_user: db_driver: orm firewall_name: main user_class: Zoef\UserBundle\Entity\Userere
And something like this for the oauth server
fos_oauth_server: db_driver: orm client_class: {PATH TO ENTITY}\Client access_token_class: {PATH TO ENTITY}\AccessToken refresh_token_class: {PATH TO ENTITY}\RefreshToken auth_code_class: {PATH TO ENTITY}\AuthCode service: user_provider: fos_user.user_provider.username
And the security.yml should look like this:
security: encoders: FOS\UserBundle\Model\UserInterface: sha512 providers: fos_userbundle: id: fos_user.user_provider.username firewalls: oauth_token: pattern: ^/oauth/v2/token security: false access_control: - { path: ^/, roles: ROLE_ADMIN }
You can test if it works because when you got to any url you should get an reponse like this:
{"error":"access_denied","error_description":"OAuth2 authentication required"}