Created
September 17, 2013 20:41
-
-
Save niraj-shah/6600299 to your computer and use it in GitHub Desktop.
Getting a long-lived access token using the Facebook PHP SDK
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 | |
$appId = 'aaaaaaaaaaaa'; | |
$appSecret = 'bbbbbbbbbbbb'; | |
// init facebook | |
$facebook = new Facebook( array( 'appId' => $appId, 'secret' => $appSecret ) ); | |
// get user_id, 0 if not logged in | |
$user = $facebook->getUser(); | |
// check if user is logged in | |
if ( $user ) { | |
// get long-lived access token | |
$facebook->setExtendedAccessToken(); | |
$access_token = $facebook->getAccessToken(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment