/** * Returns the URL to send the user in order to log out of Facebook. * * @param FacebookSession $session The session that will be logged out * @param string $next The url Facebook should redirect the user to after * a successful logout * * @return string * * @throws FacebookSDKException */ public function getLogoutUrl(FacebookSession $session, $next) { if ($session->getAccessToken()->isAppSession()) { throw new FacebookSDKException('Cannot generate a Logout URL with an App Session.', 722); } $params = array('next' => $next, 'access_token' => $session->getToken()); return 'https://www.facebook.com/logout.php?' . http_build_query($params, null, '&'); }