Skip to content

Commit

Permalink
making facebook auth/perms
Browse files Browse the repository at this point in the history
  • Loading branch information
zachwe committed Feb 26, 2011
0 parents commit 7fff0f2
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions facebook
34 changes: 34 additions & 0 deletions fb-auth.php
@@ -0,0 +1,34 @@
<?php
require_once('facebook/facebook.php');

class FacebookAuth {
//Application ID
static $appid = '195701533788444';
//Fb Application Secret
static $secret = '8ebe972a0b19ea0def1a4fc9ab9005b4';

//Returns a Facebook object
static function getFacebook() {
return new Facebook(array('appId'=>FacebookAuth::$appid,
'secret'=>FacebookAuth::$secret,
'cookie'=>true));
}

//
static function getSession() {
$facebook = FacebookAuth::getFacebook();
$session = $facebook->getSession();
$me = null;
if ($session) {
try {
$uid = $facebook->getUser();
$me = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
}
}
return $facebook;

}
}
?>
17 changes: 17 additions & 0 deletions index.php
@@ -0,0 +1,17 @@
<?php
require_once('fb-auth.php');
$facebook = FacebookAuth::getSession();
$naitik = $facebook->api('/naitik');
?>
<html>
<head>

</head>
<body>
<p>Welcome to Facebook Cleanser!</p>

<?php
echo $naitik['name']
?>
</body>
</html>

0 comments on commit 7fff0f2

Please sign in to comment.