Created
October 5, 2013 15:43
-
-
Save richardpilgrim/6842442 to your computer and use it in GitHub Desktop.
Facebook PHP Logout Example Code to only logout user from app and not from Facebook. Essentially revoke the permission from your app.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require '../src/facebook.php'; | |
// Create our Application instance (replace this with your appId and secret). | |
$facebook = new Facebook(array( | |
'appId' => '<appid>', | |
'secret' => '<appsecret>', | |
)); | |
// Get User ID | |
$user = $facebook->getUser(); | |
if($user) | |
{ | |
$permissions = $user.'/permissions'; | |
$facebook->api($permissions, "DELETE"); | |
session_destroy(); | |
header("Location: example.php"); | |
die(); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment