Closed ngoodwin14 closed 5 years ago
As stated elsewhere, the solution is to decorate the the original controller. In service.yaml
do
App\Infrastructure\Controller\Account\TokenController:
decorates: FOS\OAuthServerBundle\Controller\TokenController
arguments: ['@fos_oauth_server.server']
tags: ['controller.service_arguments']
(assuming your custom controller is in App\Infrastructure\Controller\Account\TokenController)
@AntoniusGolly I did it, but got this error on v3.4
Type error: Too few arguments to function MccpAuthBundle\\Controller\\OauthController::__construct(), 0 passed in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php on line 200 and exactly 1 expected
Could you show a repo with app?
I am using the following packages:
I am attempting to override the tokenAction method of the FOSOAuthServerBundle package, but I am getting stuck on the error:
I have tried several different approaches (autowire, auto-injection), but I keep coming full circle back to the error described above. It seems that the "use OAuth2\OAuth2;" reference is properly namespaced in the bundle's TokenController, but when I try to override it cannot parse the OAuth2 class locations properly, and I am not sure what pattern to use either in the class or in the services.yaml to point it to the right location.
Here is my services.yaml
And my custom TokenController class
And if I try to do the obvious and add the line
to my custom TokenController I get the same error.