From 24152cdb5e48edc5128082b285736b06ebda3c82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 15 Feb 2016 22:12:50 +0100 Subject: Fix #1597: first draft to create new client for the API --- .../CoreBundle/Controller/DeveloperController.php | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/Wallabag/CoreBundle/Controller/DeveloperController.php (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/DeveloperController.php b/src/Wallabag/CoreBundle/Controller/DeveloperController.php new file mode 100644 index 00000000..3cb86881 --- /dev/null +++ b/src/Wallabag/CoreBundle/Controller/DeveloperController.php @@ -0,0 +1,38 @@ +render('WallabagCoreBundle:Developer:index.html.twig'); + } + + /** + * @param Request $request + * + * @Route("/developer/client/create", name="create_client") + */ + public function createClientAction(Request $request) + { + $clientManager = $this->container->get('fos_oauth_server.client_manager.default'); + $client = $clientManager->createClient(); + $client->setRedirectUris(array('http://www.example.com')); + $client->setAllowedGrantTypes(array('token', 'authorization_code')); + $clientManager->updateClient($client); + + return $this->render('WallabagCoreBundle:Developer:client.html.twig', array( + 'client_id' => $client->getPublicId(), + )); + } +} -- cgit v1.2.3