public function testAnAppAccessTokenCanBeDetected() { $normalToken = new AccessToken('foo_token'); $isNormalToken = $normalToken->isAppAccessToken(); $this->assertFalse($isNormalToken, 'Normal access token not expected to look like an app access token.'); $appToken = new AccessToken('123|secret'); $isAppToken = $appToken->isAppAccessToken(); $this->assertTrue($isAppToken, 'App access token expected to look like an app access token.'); }
/** * Returns the URL to send the user in order to log out of Facebook. * * @param AccessToken|string $accessToken The access token that will be logged out. * @param string $next The url Facebook should redirect the user to after a successful logout. * @param string $separator The separator to use in http_build_query(). * * @return string * * @throws FacebookSDKException */ public function getLogoutUrl($accessToken, $next, $separator = '&') { if (!$accessToken instanceof AccessToken) { $accessToken = new AccessToken($accessToken); } if ($accessToken->isAppAccessToken()) { throw new FacebookSDKException('Cannot generate a logout URL with an app access token.', 722); } $params = ['next' => $next, 'access_token' => $accessToken->getValue()]; return 'https://www.facebook.com/logout.php?' . http_build_query($params, null, $separator); }