/** * display a message to the user before redirecting him to facebook */ protected function executeRedirectScreen() { $appId = $this->getFromConfig(FacebookConstants::FACEBOOK_APP_ID_REQUEST_PARAM); $appSecret = $this->getFromConfig(FacebookConstants::FACEBOOK_APP_SECRET_REQUEST_PARAM); $permissions = explode(',', base64_decode($this->getRequestParameter(FacebookConstants::FACEBOOK_PERMISSIONS_REQUEST_PARAM))); $providerId = base64_decode($this->getRequestParameter(FacebookConstants::FACEBOOK_PROVIDER_ID_REQUEST_PARAM)); $requestPartnerId = base64_decode($this->getRequestParameter(FacebookConstants::FACEBOOK_PARTNER_ID_REQUEST_PARAM)); $ksStr = $this->getRequestParameter(FacebookConstants::FACEBOOK_KS_REQUEST_PARAM); $this->ksError = null; $this->partnerError = null; $ksValid = $this->processKs($ksStr); if (!$ksValid) { $this->ksError = true; return; } $ks = kCurrentContext::$ks_object; $contextPartnerId = $ks->partner_id; if (empty($requestPartnerId) || $contextPartnerId != $requestPartnerId) { $this->partnerError = true; return; } $ks = $this->generateTimeLimitedKs($contextPartnerId); $params = $this->getForwardParameters(); $params[FacebookConstants::FACEBOOK_KS_REQUEST_PARAM] = $ks; $params[FacebookConstants::FACEBOOK_NEXT_ACTION_REQUEST_PARAM] = base64_encode(self::SUB_ACTION_PROCESS_OAUTH2_RESPONSE); $accessURL = $this->getFacebookDistributionAccessURL($providerId, $ks); $dataHandler = new kDistributionPersistentDataHandler($accessURL); $redirectUrl = $this->getController()->genUrl('extservices/facebookoauth2?' . http_build_query($params, null, '&'), true); $reRequestPermissions = base64_decode($this->getRequestParameter(FacebookConstants::FACEBOOK_RE_REQUEST_PERMISSIONS_REQUEST_PARAM)); $this->oauth2Url = FacebookGraphSdkUtils::getLoginUrl($appId, $appSecret, $redirectUrl, $permissions, $dataHandler, $reRequestPermissions); }