I'm trying to create a Bolt extension to be able to login via a REST endpoint. But I can't capture the values from the request.
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
public function initialize()
{
$this->app->post("/rest/session", array($this, 'rest_login'))
->bind('rest_login');
}
public function rest_login(Request $request) {
// Get credentials
$username = $request->get('username');
$password = $request->get('password');
// Attempt login
$login = $this->app['users']->login($username, $password);
$response = $this->app->json(array('login' => $login));
return $response;
}
If I return after getting $username
and $password
I can see that these are both NULL, even though they have been sent as POST data - how do I capture these values?