I'm defining a new Controller to act as a proxy between a JS app and the OAuth server. The code is below:
namespace Acme\SecurityBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
class ProxyController extends Controller
{
public function forwardTokenRequestAction(Request $request)
{
if( ! $request->isXmlHttpRequest() )
{
throw WhateverException();
}
$request->request->add( array(
'client_id'=>'...',
'client_secret'=>'...'
));
return $this->forward('FOSOAuthServerBundle:Token:token');
}
}
But I get the following error since the TokenController I'm forwarding to has a contructor expecting an OAuth server as a parameter:
Catchable Fatal Error: Argument 1 passed to FOS\\OAuthServerBundle\\Controller\\TokenController::__construct() must be an instance of OAuth2\\OAuth2, none given
I do not know:
- where I can get this server instance
- how can I pass it to the TokenController
- if my method as a whole is correct or not