symfonyfosoauthserverbundle

FOSOAuthServerBundle + Symfony 4 Configuration - can't import routes


I'm trying to configure the Bundle according to the official documentation, but when I add routes (as described in the docs)

Import the routing.yml configuration file in app/config/routing.yml: fos_oauth_server_token: resource: "@FOSOAuthServerBundle/Resources/config/routing/token.xml" fos_oauth_server_authorize: resource: "@FOSOAuthServerBundle/Resources/config/routing/authorize.xml"

I got an error:

There is no extension able to load the configuration for "fos_oauth_server_token" (in /var/app/ondeck/config/packages/routing.yaml). Looked for namespace "fos_oauth_server_token", found "framework", "twig", "security", "nelmio_cors", "doctrine_cache", "doctrine", "api_platform", "fos_oauth_server" in /var/app/ondeck/config/packages/routing.yaml (which is loaded in resource "/var/app/ondeck/config/packages/routing.yaml").

Any ideas?


Solution

  • You're importing your routes in the wrong file.

    The config/packages/routing.yaml file is here for the router configuration, not for defining routes.

    You should have a config/routes directory, import the FOSOAuthServerBundle routes here.