Skip to content

Instantly share code, notes, and snippets.

View bmarshall511's full-sized avatar

Ben Marshall bmarshall511

View GitHub Profile
<?php
$session = new FacebookSession('access token here');
<?php
$helper = new FacebookJavaScriptLoginHelper();
try {
$session = $helper->getSession();
} catch(FacebookRequestException $ex) {
// When Facebook returns an error
} catch(\Exception $ex) {
// When validation fails or other local issues
}
if ($session) {
<?php
$helper = new FacebookCanvasLoginHelper();
try {
$session = $helper->getSession();
} catch(FacebookRequestException $ex) {
// When Facebook returns an error
} catch(\Exception $ex) {
// When validation fails or other local issues
}
if ($session) {
<?php
$helper = new FacebookRedirectLoginHelper();
try {
$session = $helper->getSessionFromRedirect();
} catch(FacebookRequestException $ex) {
// When Facebook returns an error
} catch(\Exception $ex) {
// When validation fails or other local issues
}
if ($session) {
<?php
$helper = new FacebookRedirectLoginHelper('your redirect URL here');
$loginUrl = $helper->getLoginUrl();
// Use the login url on a link or button to redirect to Facebook for authentication
<?php
FacebookSession::setDefaultApplication('YOUR_APP_ID', 'YOUR_APP_SECRET');
{
"require" : {
"facebook/php-sdk-v4" : "4.0.*"
}
}
.content {
border-color: #3bbfce;
color: #2b9eab;
}
$blue: #3bbfce
.content
border-color: $blue
color: darken($blue, 9%)
$blue: #3bbfce;
.content {
border-color: $blue;
color: darken($blue, 9%);
}