- $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);
+ $em = $this->getDoctrine()->getManager();
+ $client = new Client();
+ $clientForm = $this->createForm(ClientType::class, $client);
+ $clientForm->handleRequest($request);
+
+ if ($clientForm->isValid()) {
+ $client->setAllowedGrantTypes(array('token', 'authorization_code', 'password', 'refresh_token'));
+ $em->persist($client);
+ $em->flush();
+
+ $this->get('session')->getFlashBag()->add(
+ 'notice',
+ 'New client created.'
+ );
+
+ return $this->render('WallabagCoreBundle:Developer:client_parameters.html.twig', array(
+ 'client_id' => $client->getPublicId(),
+ 'client_secret' => $client->getSecret(),
+ ));
+ }