Helper for Facebook integration.

package XenForo_Facebook

 Methods

Takes a code (with a redirect URL) and gets an access token.

getAccessToken(string $url, string $code) : array | false

Parameters

$url

string

$code

string

Returns

arrayfalseArray of info (may be error); false if Facebook integration not active

getAccessTokenFromCode()

getAccessTokenFromCode($code, $redirectUri) 

Parameters

$code

$redirectUri

getFacebookRequestErrorInfo()

getFacebookRequestErrorInfo($result, $expectedKey) 

Parameters

$result

$expectedKey

Gets the URL to request Facebook permissions.

getFacebookRequestUrl(string $redirectUri, string | null $appId, string | null $state) : string

Parameters

$redirectUri

string

URL to return to

$appId

stringnull

Facebook app ID

$state

stringnull

CSRF Protection

Returns

string

Gets Facebook user info from the specified place.

getUserInfo(string $accessToken, string $path) : array

Parameters

$accessToken

string

FB access token (from code swap, or given by user); may be empty

$path

string

Path to access (defaults to "me")

Returns

arrayInfo; may be error

Gets the user picture for the current user.

getUserPicture(string $accessToken, string $size) : string

Parameters

$accessToken

string

FB access token (from code swap, or given by user)

$size

string

Size/type of picture. Defaults to large

Returns

stringBinary data

Sets the fbUid cookie that is used by the JavaScript.

setUidCookie(integer $fbUid) 

Parameters

$fbUid

integer

64-bit int of FB user ID