autoRender = false; $Opauth = $this->_getOpauthInstance(); $response = $Opauth->run(); if (empty($callback)) { return; } $url = $this->_generateOpauthCompleteUrl(); $this->request->session()->write(Configure::read('Users.Key.Session.social'), $response); return $this->redirect($url); } /** * Generates the opauth callback url * * @return string Full translated URL with base path. */ protected function _generateOpauthCompleteUrl() { $url = Configure::read('Opauth.complete_url'); if (!is_array($url)) { $url = Router::parse($url); } $url['?'] = ['social' => $this->request->query('code')]; return Router::url($url, true); } /** * Render the social email form * * @throws NotFoundException * @return void */ public function socialEmail() { if (!$this->request->session()->check(Configure::read('Users.Key.Session.social'))) { throw new NotFoundException(); } } /** * Gets OpauthFactory instance * * @return OpauthFactory */ protected function _getOpauthInstance() { return OpauthFactory::create(Configure::read('Opauth')); } }