Kover as a service ( Formerly on [https://kaas.fun](kaas.fun) )
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.2 KiB
41 lines
1.2 KiB
# login-callback.php
|
|
<?php
|
|
require( __DIR__.'/facebook_start.php' );
|
|
|
|
$helper = $fb->getRedirectLoginHelper();
|
|
|
|
try {
|
|
$accessToken = $helper->getAccessToken();
|
|
}
|
|
catch(Facebook\Exceptions\FacebookResponseException $e) {
|
|
// When Graph returns an error
|
|
echo 'Graph returned an error: ' . $e->getMessage();
|
|
exit;
|
|
}
|
|
catch(Facebook\Exceptions\FacebookSDKException $e) {
|
|
// When validation fails or other local issues
|
|
echo 'Facebook SDK returned an error: ' . $e->getMessage();
|
|
exit;
|
|
}
|
|
|
|
if (isset($accessToken)) {
|
|
// Logged in!
|
|
$_SESSION['facebook_access_token'] = (string) $accessToken;
|
|
//echo $_SESSION['facebook_access_token'];
|
|
|
|
header("Location: overlay.php"); //redirect
|
|
die();
|
|
//"overlay",array("token"=> $token),true);
|
|
// Now you can redirect to another page and use the
|
|
// access token from $_SESSION['facebook_access_token']
|
|
} elseif ($helper->getError()) {
|
|
// The user denied the request
|
|
var_dump($helper->getError());
|
|
var_dump($helper->getErrorCode());
|
|
var_dump($helper->getErrorReason());
|
|
var_dump($helper->getErrorDescription());
|
|
exit;
|
|
}
|
|
http_response_code(400);
|
|
exit;
|
|
|
|
|