1

即使我退出 Facebook,我似乎也无法将访问令牌视为无效。

    if ($user) {
          try {
            // Proceed knowing you have a logged in user who's authenticated.
            $user_profile = $facebook->api('/me');
 echo "Name: " . $user_profile['name'];
          } catch (FacebookApiException $e) {
    // If the user is logged out, you can have a 
            // user ID even though the access token is invalid.
            // In this case, we'll get an exception, so we'll
            // just ask the user to login again here.
            error_log($e);
            $user = null;
          }
        }

即使我退出 facebook,我仍然可以取回用户名。所以显然访问令牌似乎仍然有效。我怎样才能解决这个问题?

或者我应该只在 iframe 的 FB 环境中测试我的应用程序吗?

4

1 回答 1

0

访问令牌不依赖于您在 Facebook 上的身份验证状态。您正在使用的 Facebook PHP SDK 将访问令牌存储在 PHP 会话中。所以,你可以清理你的会话。

于 2012-01-11T12:59:16.207 回答