3 namespace Wallabag\ImportBundle\Controller
;
5 use Symfony\Bundle\FrameworkBundle\Controller\Controller
;
6 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route
;
8 class PocketController
extends Controller
11 * @Route("/import/pocket", name="pocket_import")
13 public function indexAction()
15 return $this->render('WallabagImportBundle:Pocket:index.html.twig', array());
19 * @Route("/import/pocket/auth", name="pocket_auth")
21 public function authAction()
23 $pocket = $this->get('wallabag_import.pocket.import');
24 $authUrl = $pocket->oAuthRequest(
25 $this->generateUrl('import', array(), true),
26 $this->generateUrl('pocket_callback', array(), true)
29 return $this->redirect($authUrl, 301);
33 * @Route("/import/pocket/callback", name="pocket_callback")
35 public function callbackAction()
37 $pocket = $this->get('wallabag_import.pocket.import');
38 $accessToken = $pocket->oAuthAuthorize();
39 $pocket->import($accessToken);
41 return $this->redirect($this->generateUrl('homepage'));