public function redirect() { $facebookClient = new FacebookClient(); $helper = new FacebookRedirectLoginHelper($this->facebookApp); $permissions = ['email', 'user_likes']; // optional $loginUrl = $helper->getLoginUrl('http://www.schoolmanager.or.ke/login', $permissions); header('Location: ' . $loginUrl); //echo '<a href="' . $loginUrl . '">Log in with Facebook!</a>'; }
public function testLoginURL() { $app = new FacebookApp('123', 'foo_app_secret'); $helper = new FacebookRedirectLoginHelper($app, $this->persistentDataHandler); $scope = ['foo', 'bar']; $loginUrl = $helper->getLoginUrl(self::REDIRECT_URL, $scope, true, 'v1337'); $expectedUrl = 'https://www.facebook.com/v1337/dialog/oauth?'; $this->assertTrue(strpos($loginUrl, $expectedUrl) === 0, 'Unexpected base login URL returned from getLoginUrl().'); $params = ['client_id' => '123', 'redirect_uri' => self::REDIRECT_URL, 'state' => $_SESSION['FBRLH_state'], 'sdk' => 'php-sdk-' . Facebook::VERSION, 'scope' => implode(',', $scope)]; foreach ($params as $key => $value) { $this->assertTrue(strpos($loginUrl, $key . '=' . urlencode($value)) !== false); } }
public function testLoginURL() { $helper = new FacebookRedirectLoginHelper(FacebookTestCredentials::$appId, FacebookTestCredentials::$appSecret); $helper->disableSessionStatusCheck(); $loginUrl = $helper->getLoginUrl(self::REDIRECT_URL); $state = $_SESSION['FBRLH_state']; $params = array('client_id' => FacebookTestCredentials::$appId, 'redirect_uri' => self::REDIRECT_URL, 'state' => $state, 'sdk' => 'php-sdk-' . FacebookRequest::VERSION, 'scope' => implode(',', array())); $expectedUrl = 'https://www.facebook.com/v2.0/dialog/oauth?'; $this->assertTrue(strpos($loginUrl, $expectedUrl) !== false); foreach ($params as $key => $value) { $this->assertTrue(strpos($loginUrl, $key . '=' . urlencode($value)) !== false); } }
public function getLoginUrl($url) { $permissions = array('manage_pages', 'publish_pages'); return $this->helper->getLoginUrl($url, $permissions); }
public function fblogin() { $this->autoRender = false; if (session_status() == PHP_SESSION_NONE) { session_start(); } FacebookSession::setDefaultApplication('491776471001011', '2383aae6c102275bafd2ff7f118d988f'); $helper = new FacebookRedirectLoginHelper('http://localhost/cakephp3/users/fb_login'); $url = $helper->getLoginUrl('http://localhost/cakephp3/users/fb_login', array('email')); $this->redirect($url); }
public function getLoginUrl($callbackRoute) { return $this->helper->getLoginUrl($this->router->generate($callbackRoute, [], UrlGenerator::ABSOLUTE_URL), ['email']); }
public function getLoginUrl($redirectUrl, $scope = null) { $helper = new FacebookRedirectLoginHelper($redirectUrl); return $helper->getLoginUrl(['scope' => $scope]); }