public function postAction(Request $request)
    {
        try {
            return $this->createJsonResponse($this->get('oauth.server')->grant(
                $this->getRequestData($request, 'snakelize')
            ));
        } catch (InvalidGrantException $e) {
            return new JsonResponse('Unavailable to create access token : bad credentials.', 401);
        } catch (\InvalidArgumentException $e) {
            return new JsonResponse('Invalid or missing fields for grant type.', 400);
        }
    }
public function postAction(Request $request)
    {
        try {
            return $this->createJsonResponse($this->get('oauth.server')->grant(
                $this->getRequestData($request, 'snakelize')
            ));
        } catch (InvalidGrantException $e) {
            return new JsonResponse('Unavailable to create access token : bad credentials.', 401);
        } catch (\InvalidArgumentException $e) {
            return new JsonResponse('Invalid or missing fields for grant type.', 400);
        }
    }
public function postAction ( Request $ request ) { try { return $ this -> createJsonResponse ( $ this -> get ( 'oauth.server' ) -> grant ( $ this -> getRequestData ( $ request , 'snakelize' ) ) ) ; } catch ( InvalidGrantException $ e ) { return new JsonResponse ( 'Unavailable to create access token : bad credentials.' , 401 ) ; } catch ( \ InvalidArgumentException $ e ) { return new JsonResponse ( 'Invalid or missing fields for grant type.' , 400 ) ; } }
Create a new access_token from given request throught oAuth server.

@param Request $request

@return Response
Create a new access_token from given request throught oAuth server .