I am trying to implement the FOSOAuthServerBundle. I need it in order to create a centralized authentication function that will be shared by some other projects.
I followed the tutorial from here: Getting Started With FOSOAuthServerBundle
But I have a problem now: When trying to access the route auth.local/app_dev.php/oauth/v2/auth, I am getting the following error:
InvalidConfigurationException: The child node "providers" at path "security" must be configured.
Here is my security.yml:
security:
firewalls:
api:
pattern: /api
fos_oauth: true
stateless: true
oauth_authorize:
pattern: /oauth/v2/auth
form_login:
provider: fos_userbundle
check_path: /oauth/v2/auth_login_check
login_path: /oauth/v2/auth_login
anonymous: true
oauth_token:
pattern: /oauth/v2/token
security: false
access_control:
- { path: ^/oauth/v2/auth_login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
This error doesn't have much to do with FOSOAuthServerBundle, but rather your security.yml configuration. You haven't specified a provider, so symfony doesn't know where to load the users from. You should read the security page in the Symfony docs to see how to configure it properly. If you want users that are in a database, look at loading users from a database. Either way, you should have a security.yml that has a structure like this:
You can fill in each section by looking through the docs and using what suits your needs best, there are lots of options. But you must have a
providers
section.