Skip to content
This repository was archived by the owner on Jan 13, 2022. It is now read-only.

4.0 dev #1242

Open
wants to merge 118 commits into
base: 5.x
Choose a base branch
from
Open

4.0 dev #1242

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
ebde5ad
Added developer site doc content, needs updating for 4.0.9
Jul 21, 2014
0b7d22f
Fix "Fatal error: Cannot use object of type stdClass as array"
Aug 1, 2014
00a1bf4
Merge pull request #179 from complex857/4.0-dev
Aug 2, 2014
f4e97f8
[4.0] Fixed warnings when open_basedir directive set
SammyK Aug 4, 2014
f75cadd
Fixed long lived sessions forgetting the signed request
SammyK Aug 11, 2014
da07c23
Merge pull request #186 from SammyK/fix-for-open_basedir-directive-4.0
Aug 12, 2014
ee46bce
Merge pull request #191 from SammyK/fix-long-lived-session-forgets-si…
Aug 12, 2014
d303ca4
Removed GET processing from CanvasLoginHelper.
Aug 12, 2014
aac9f3a
Merge pull request #195 from facebook/gFosco.canvasGET-40dev
Aug 12, 2014
7a6fe06
Updated visibility on FacebookSession::useAppSecretProof
Aug 12, 2014
ea577e1
Merge pull request #197 from facebook/gFosco.session-appsecret-40dev
Aug 12, 2014
e8d30a3
[4.0] Disambiguate versions
SammyK Aug 13, 2014
9ff0b14
Merge pull request #202 from SammyK/update-readme-badge-4.0
Aug 13, 2014
e2dc662
Added a method to disable IPv6 resolution.
Aug 25, 2014
455c83c
Updated version number
SammyK Sep 4, 2014
3f53955
Merge pull request #222 from SammyK/update-version
Sep 8, 2014
f9e3228
Adding session_start() to the initialization docs.
leonelsr Sep 12, 2014
b3b00f0
Merge pull request #236 from leonelsr/patch-1
gfosco Sep 13, 2014
4cad9e0
At least one endpoint allows for the type parameter to be set in the …
asolberg Sep 22, 2014
906c5ef
Merge pull request #242 from asolberg/next_request_type_path_conflict
gfosco Sep 23, 2014
5c2b6d4
FacebookRedirectLoginHelper::getReRequestUrl
Oct 1, 2014
45cb633
getReRequestUrl: state restored
Oct 1, 2014
b85e1ab
getReRequestUrl: state removed again
Oct 1, 2014
a78ff2d
Merge pull request #243 from urmaul/4.0-dev
gfosco Oct 9, 2014
3a0c24d
add `getEmail()` method to `Facebook::GraphUser()`
Oct 23, 2014
b31ab68
Merge pull request #253 from r3wt/4.0-dev
gfosco Oct 24, 2014
0683838
Updating default Graph API version to 2.2
Oct 30, 2014
ddcce21
Merge pull request #255 from facebook/gFosco.graph-v2.2
gfosco Oct 30, 2014
6fda76a
Add PHP open tags for syntax highlight
bocharsky-bw Oct 31, 2014
d101f46
Add displayAsPopup parameter for getLoginUrl
ebuildy Nov 4, 2014
5822b18
Quick version correction in readme
SammyK Nov 4, 2014
f807076
Merge pull request #256 from bocharsky-bw/patch-1
gfosco Nov 4, 2014
158acd4
Merge pull request #258 from ebuildy/patch-1
gfosco Nov 4, 2014
445a03e
Merge pull request #260 from SammyK/version-fix
gfosco Nov 4, 2014
8fa50e6
Updated version constraint
SammyK Nov 9, 2014
29fda0e
minor bug fix about strpos function and minor optimization
himuhasib Nov 9, 2014
15fa818
Merge pull request #270 from hasib71/4.0-dev
gfosco Nov 12, 2014
02bbc63
Merge pull request #268 from SammyK/update-version-constraint
gfosco Nov 12, 2014
65c24b9
Autoloader documentation for non-Composer
adamgross42 Dec 7, 2014
8d04d00
Merge pull request #289 from adamgross42/4.0-dev
gfosco Dec 8, 2014
70fd253
Made peer verification more secure
SammyK Dec 10, 2014
83e9696
Merge pull request #295 from SammyK/made-peer-verification-more-secure
gfosco Dec 12, 2014
ba73290
Updating version to 4.0.13
Dec 12, 2014
d6b337b
Update GraphUser.php
georgecoca Dec 20, 2014
5959fe8
Added CSRF protection for rerequest links
SammyK Dec 24, 2014
fd22f6b
fixed spacing on GraphAlbum object
leonar15 Dec 27, 2014
242879e
Merge pull request #303 from geodeveloper/patch-1
gfosco Dec 29, 2014
263df57
Merge pull request #311 from SammyK/add-state-to-rerequest
gfosco Dec 29, 2014
bfb6f28
Merge pull request #312 from leonar15/4.0-dev
gfosco Dec 29, 2014
566c4ea
Updated to 4.0.14
Dec 29, 2014
fd6d9c5
Prevent generation of logout url with app session.
Jan 6, 2015
4cc5f76
Updated AccessToken->isAppSession
Jan 6, 2015
88af90d
Merge pull request #316 from facebook/gFosco.40-logout-url
gfosco Jan 6, 2015
ebc8266
Updated to 4.0.15
Jan 6, 2015
7777707
Add mandatory param to the RedirectLoginHelper constructor
Laurent-Sarrazin Jan 21, 2015
36ec0f3
allow to force re-authenticate with getLoginUrl method
Jan 21, 2015
eb74731
Calling init creates a curl handler without checking if a handle has …
jkrasnoo Jan 23, 2015
e5d4c3e
Merge pull request #328 from jkrasnoo/4.0-dev
gfosco Jan 27, 2015
676958c
Merge pull request #324 from Laurent-Sarrazin/patch-1
gfosco Feb 1, 2015
879c606
Merge pull request #325 from vrcAlbert/feature/reauthentication
gfosco Feb 3, 2015
66da9e0
Updating release to 4.0.16
Feb 3, 2015
f93c139
Update FacebookRedirectLoginHelper.php
yguedidi Feb 3, 2015
9530e55
Fix previous commit with strict check
yguedidi Feb 3, 2015
9154dc7
Merge pull request #341 from yguedidi/patch-1
gfosco Feb 4, 2015
ff0c33f
getTimezone for GraphUser
MauricioKruijer Feb 6, 2015
6503419
not renamed to in f93c1398dd58da9fcd9bae93db9038bb23fd3cab
miteshashar Feb 7, 2015
cf1defb
Merge pull request #344 from tagglabs/myphpfb
gfosco Feb 7, 2015
b524d13
Merge pull request #343 from MauricioKruijer/4.0-dev
gfosco Feb 7, 2015
a1d2c5b
clear the curl handle after closing it
mlebkowski Feb 13, 2015
a228d55
added support for graph-video url
zoharbabin Feb 15, 2015
3e272f9
SCA (Static Code Analysis) warnings partially fixed (code style, if c…
kalessil Feb 15, 2015
a7ec692
Merge pull request #357 from mlebkowski/fix-curl-close
gfosco Feb 16, 2015
ba3c9e5
Merge pull request #358 from zoharbabin/patch-1
gfosco Feb 17, 2015
145ee67
Fixed end() producing a ContextError when using E_STRICT mode
Feb 18, 2015
fe0624f
reverted declined changes
kalessil Feb 18, 2015
a4d202d
Tabs to spaces
Loxo Feb 19, 2015
0413e1c
Merge pull request #359 from kalessil/SCA
gfosco Feb 19, 2015
0a5b793
Merge pull request #360 from Loxo/4.0-dev
gfosco Feb 19, 2015
93ea67b
Updating to 4.0.17
Feb 19, 2015
6c904f9
revert interface change
mlebkowski Feb 24, 2015
e7425cf
Merge pull request #367 from mlebkowski/fix/breaking-changes
gfosco Feb 24, 2015
e3f5645
Updated to 4.0.18
Feb 24, 2015
507c182
Updated FacebookRedirectLoginHelper and SignedRequest to constant tim…
Mar 2, 2015
2ed50e1
Changed validateCsrf from mb_strlen to strlen
Mar 2, 2015
8f65adc
Merge pull request #372 from facebook/gFosco.csrf2
gfosco Mar 2, 2015
20e17fe
Updated to 4.0.19
Mar 2, 2015
11899c9
fix: validate state
ilanco Mar 2, 2015
06a74cf
fix: get state with loadState()
ilanco Mar 2, 2015
a022631
Merge pull request #373 from ilanco/valid-redirect-fix
gfosco Mar 3, 2015
0c8ea23
Updated to 4.0.20
Mar 3, 2015
e594fbe
Add a final class holding all permissions
Mar 24, 2015
b583b4a
Merge pull request #381 from 0x46616c6b/permission-enum
gfosco Mar 31, 2015
2156afc
Fix for multidimensional params support
SammyK Apr 1, 2015
085ed43
Graph version bump to v2.3
SammyK Apr 1, 2015
4e2a744
Merge pull request #386 from SammyK/4.0-multi-array
gfosco Apr 2, 2015
4d724b3
Merge pull request #387 from SammyK/4.0-graph-2.3
gfosco Apr 2, 2015
0017521
Updated to 4.0.22
Apr 2, 2015
46d5de0
Fix stdClass error on FacebookRedirectLoginHelper because response ha…
SammyK Apr 3, 2015
d620878
Merge pull request #393 from SammyK/4.0-access-token-response-fix
gfosco Apr 3, 2015
c82611e
Updated to 4.0.23
Apr 3, 2015
2ca747e
Added getLocale()
holtkamp May 4, 2015
883ff09
Fix `getExpiresAt` Typo.
irazasyed May 11, 2015
0901ebb
Merge pull request #428 from irazasyed/fix-docs-typo
gfosco May 12, 2015
f7e4793
Merge pull request #414 from holtkamp/patch-1
gfosco May 13, 2015
1aac859
wrong number of scopes in test
May 21, 2015
febedbe
Merge pull request #442 from kesar/fix_test_sesion_scopes
gfosco May 28, 2015
3fc57df
Update FacebookRequest.php
May 30, 2015
2eed411
Update FacebookRequest.php
Jun 2, 2015
1c90cb3
Update FacebookRequest.php
Jun 3, 2015
1027056
Merge pull request #448 from gargoyle/patch-1
gfosco Jun 9, 2015
ae612c6
Fix typo in docs code
petk Jun 9, 2015
a18b7cb
Merge pull request #454 from peterkokot/patch-typo
gfosco Jun 9, 2015
3189e71
Normalize php documentation in SignedRequest.php
christophlehmann Jun 17, 2015
2899e36
Merge pull request #455 from christophlehmann/4.0-dev
gfosco Jun 18, 2015
77e2c10
Fix: Remove unused import
localheinz Jul 7, 2015
5ab5c61
Fix: No need for else branch as we're returning early
localheinz Jul 7, 2015
48e397b
Merge pull request #461 from localheinz/fix/unused-import
gfosco Jul 8, 2015
7c3425b
Merge pull request #462 from localheinz/fix/return
gfosco Jul 8, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Facebook SDK for PHP
====================

[![Latest Stable Version](http://img.shields.io/packagist/v/facebook/php-sdk-v4.svg)](https://packagist.org/packages/facebook/php-sdk-v4)
[![Latest Stable Version](http://img.shields.io/badge/Latest%20Stable-4.0.23-blue.svg)](https://packagist.org/packages/facebook/php-sdk-v4)


This repository contains the open source PHP SDK that allows you to access Facebook
Expand All @@ -16,6 +16,12 @@ This version of the Facebook SDK for PHP requires PHP 5.4 or greater.
Minimal example:

```php
<?php

// Skip these two lines if you're using Composer
define('FACEBOOK_SDK_V4_SRC_DIR', '/path/to/facebook-php-sdk-v4/src/Facebook/');
require __DIR__ . '/path/to/facebook-php-sdk-v4/autoload.php';

use Facebook\FacebookSession;
use Facebook\FacebookRequest;
use Facebook\GraphUser;
Expand Down
37 changes: 37 additions & 0 deletions docs/FacebookCanvasLoginHelper.fbmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<card>
# FacebookCanvasLoginHelper for the Facebook SDK for PHP

A helper class for getting a FacebookSession in a Canvas app
</card>

<card>
## Facebook\FacebookCanvasLoginHelper {#overview}

If your app is loaded through Canvas, Facebook sends a POST request with a signed request. This helper class will handle processing and validating that information with Facebook, and returns a `FacebookSession`.

Usage:

~~~~

$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) {
// Logged in.
}

~~~~
</card>

<card>
## Instance Methods {#instance-methods}

### getSession {#getsession}
`getSession()`
Processes the POST request from Facebook, if present. Returns a `FacebookSession` or `null`.
</card>
39 changes: 39 additions & 0 deletions docs/FacebookJavaScriptLoginHelper.fbmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<card>
# FacebookJavaScriptLoginHelper for the Facebook SDK for PHP

A helper class for getting a FacebookSession using the session from the Facebook SDK for JavaScript.
</card>

<card>
## Facebook\FacebookJavaScriptLoginHelper {#overview}

If your web app uses the Facebook SDK for JavaScript, you can access that in your PHP code as well. This helper class will process and validate the cookie data used by the Facebook SDK for JavaScript, returning a `FacebookSession` on success.

Usage:

~~~~

$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) {
// Logged in.
}

~~~~

It's important to note that on first access, or if a session has since expired, these methods will operate on data that is one request-cycle stale. You will likely want to make an Ajax request when the login state changes in the Facebook SDK for JavaScript. Information about that here: (FB.event.subscribe)[https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/#events]
</card>

<card>
## Instance Methods {#instance-methods}

### getSession {#getsession}
`getSession()`
Processes the data available from the Facebook SDK for JavaScript, if present. Returns a `FacebookSession` or `null`.
</card>
54 changes: 54 additions & 0 deletions docs/FacebookRedirectLoginHelper.fbmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<card>
# FacebookRedirectLoginHelper for the Facebook SDK for PHP

A helper class for getting a FacebookSession using the OAuth protocol.
</card>

<card>
## Facebook\FacebookRedirectLoginHelper {#overview}

If your web app uses Facebook Login on the back-end, you'll need to redirect your visitors to a URL at Facebook to initiate a login request. Facebook then redirects the user to your apps callback URL, providing session data. This helper class will generate the login URL for you, and can process and validate the data from Facebook, returning a `FacebookSession` on success.

This class can be extended, and the `storeState($state)` and `loadState()` methods overridden, to store the state check using another method besides the default `$_SESSION`.

Usage:

~~~~

$helper = new FacebookRedirectLoginHelper($redirect_url, $appId = NULL, $appSecret = NULL);
echo '<a href="' . $helper->getLoginUrl() . '">Login with Facebook</a>';

~~~~

Then, in your callback page (at the redirect url) when Facebook sends the user back:

~~~~

$helper = new FacebookRedirectLoginHelper($redirect_url);
try {
$session = $helper->getSessionFromRedirect();
} catch(FacebookRequestException $ex) {
// When Facebook returns an error
} catch(\Exception $ex) {
// When validation fails or other local issues
}
if ($session) {
// Logged in.
}

~~~~
</card>

<card>
## Instance Methods {#instance-methods}

### getLoginUrl {#getloginurl}
`getLoginUrl()`
Generates the URL to redirect a web visitor to Facebook to login to your app.
### getLogoutUrl {#getlogouturl}
`getLogoutUrl($next_url)`
Generates the URL to redirect a web visitor to Facebook to logout, with a url to redirect to after.
### getSessionFromRedirect {#getsessionfromredirect}
`getSessionFromRedirect()`
Processes the redirect data from Facebook, if present. Returns a `FacebookSession` or `null`.
</card>
59 changes: 59 additions & 0 deletions docs/FacebookRequest.fbmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<card>
# FacebookRequest for the Facebook SDK for PHP

Represents a request that will be made against the Graph API.
</card>

<card>
## Facebook\FacebookRequest {#overview}

Constructor:

~~~~
$request = new FacebookRequest(
FacebookSession $session,
string $httpMethod,
string $path,
array $params = NULL,
string $version = NULL
);
~~~~

Usage:

~~~~
// Make a new request and execute it.
try {
$response = (new FacebookRequest($session, 'GET', '/me'))->execute();
$object = $response->getGraphObject();
echo $object->getProperty('name');
} catch (FacebookRequestException $ex) {
echo $ex->getMessage();
} catch (\Exception $ex) {
echo $ex->getMessage();
}

// You can chain methods together and get a strongly typed GraphUser
$me = (new FacebookRequest(
$session, 'GET', '/me'
))->execute()->getGraphObject(GraphUser::className);
echo $me->getName();
~~~~
</card>

<card>
## Instance Methods {#instance-methods}

### execute {#execute}
`execute()`
Returns a `Facebook\FacebookResponse` from this request, from which a strongly-typed result can be retrieved. Throws an exception if the request fails. If the error is returned from Facebook, as opposed to a networking issue, a `Facebook\FacebookRequestException` is thrown.
### getPath {#getpath}
`getPath()`
Returns a copy of the path for the request, not including the version.
### getParameters {#getparams}
`getParameters()`
Returns a copy of the parameters array for the request.
### getSession {#getsession}
`getSession()`
Returns the `Facebook\FacebookSession` object associated with this request.
</card>
43 changes: 43 additions & 0 deletions docs/FacebookRequestException.fbmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<card>
# FacebookRequestException for the Facebook SDK for PHP

Represents an exception thrown by executing a Facebook request.
</card>

<card>
## Facebook\FacebookRequestException {#overview}

This base class has several subclasses:

`FacebookAuthorizationException`
`FacebookClientException`
`FacebookPermissionException`
`FacebookServerException`
`FacebookThrottleException`
`FacebookOtherException`

Whenever a FacebookRequestException is thrown, it will be one of these types.
They are derived from the error information here: https://developers.facebook.com/docs/graph-api/using-graph-api/#errors
</card>

<card>
## Instance Methods {#instance-methods}

`FacebookRequestException` extends from the base `\Exception` class, so `getCode()` and `getMessage()` are available by default.

### getHttpStatusCode {#gethttpstatus}
`getHttpStatusCode()`
Returns the HTTP status code returned with this exception.
### getSubErrorCode {#getsuberrorcode}
`getSubErrorCode()`
Returns the numeric sub-error code returned from Facebook.
### getErrorType {#geterrortype}
`getErrorType()`
Returns the type of error as a string.
### getResponse {#getresponse}
`getResponse()`
Returns the decoded response used to create the exception.
### getRawResponse {#getrawresponse}
`getRawResponse()`
Returns the raw response used to create the exception.
</card>
57 changes: 57 additions & 0 deletions docs/FacebookResponse.fbmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<card>
# FacebookResponse for the Facebook SDK for PHP

Represents a response from the Graph API.
</card>

<card>
## Facebook\FacebookResponse {#overview}

Usage:

~~~~
// A FacebookResponse is returned from an executed FacebookRequest
try {
$response = (new FacebookRequest($session, 'GET', '/me'))->execute();
// You can get the request back:
$request = $response->getRequest();
// You can get the response as a GraphObject:
$object = $response->getGraphObject();
// You can get the response as a subclass of GraphObject:
$me = $response->getGraphObject(GraphUser::className());
// If this response has multiple pages, you can get a request for the next or previous pages:
$nextPageRequest = $response->getRequestForNextPage();
$previousPageRequest = $response->getRequestForPreviousPage();
} catch (FacebookRequestException $ex) {
echo $ex->getMessage();
} catch (\Exception $ex) {
echo $ex->getMessage();
}

// You can also chain the methods together:
$me = (new FacebookRequest(
$session, 'GET', '/me'
))->execute()->getGraphObject(GraphUser::className);
echo $me->getName();
~~~~
</card>

<card>
## Instance Methods {#instance-methods}

### getGraphObject {#getgraphobject}
`getGraphObject(string $type = 'Facebook\GraphObject')`
Returns the result as a `GraphObject`. If specified, a strongly-typed subclass of `GraphObject` is returned.
### getGraphObjectList {#getgraphobjectlist}
`getGraphObjectList(string $type = 'Facebook\GraphObject')`
Returns an array of `GraphObject` returned by this request. If specified, a strongly-typed subclass of `GraphObject` is returned.
### getRequest {#getrequest}
`getRequest()`
Returns the `FacebookRequest` that produced this response.
### getRequestForNextPage {#getnextpage}
`getRequestForNextPage()`
If the response has paginated data, produces a `FacebookRequest` for the next pge of data.
### getRequestForPreviousPage {#getpreviouspage}
`getRequestForPreviousPage()`
If the response has paginated data, produces a `FacebookRequest` for the previous page of data.
</card>
71 changes: 71 additions & 0 deletions docs/FacebookSession.fbmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<card>
# FacebookSession for the Facebook SDK for PHP

Represents a Facebook Session, which is used when making requests to the Graph API.
</card>

<card>
## Facebook\FacebookSession {#overview}

Usage:

~~~~
use Facebook\FacebookSession;

FacebookSession::setDefaultApplication('app-id', 'app-secret');

// If you already have a valid access token:
$session = new FacebookSession('access-token');

// If you're making app-level requests:
$session = FacebookSession::newAppSession();

// To validate the session:
try {
$session->validate();
} catch (FacebookRequestException $ex) {
// Session not valid, Graph API returned an exception with the reason.
echo $ex->getMessage();
} catch (\Exception $ex) {
// Graph API returned info, but it may mismatch the current app or have expired.
echo $ex->getMessage();
}
~~~~
</card>

<card>
## Static Methods {#static-methods}

### setDefaultApplication {#setdefaultapp}
`setDefaultApplication(string $appId, string $appSecret)`
Configures and app ID and secret that will be used by default throughout the SDK (but can be overridden whenever necessary using parameters to other methods.
### validate {#validate}
`validate(Facebook\GraphSessionInfo $sessionInfo, string $appId = NULL, string $appSecret = NULL)`
Ensures that the provided GraphSessionInfo is valid, throwing an exception if not. It does this by ensuring the app ID in the token info matches the given (or default) app ID, ensuring the token itself is valid, and ensuring that the expiration time has not passed.
### newAppSession {#newappsession}
`newAppSession(string $appId = NULL, string $appSecret = NULL)`
Returns a `Facebook\FacebookSession` configured with a token for the app which can be used for publishing and for requesting app-level information.
### newSessionFromSignedRequest {#newsessionfromsr}
`newSessionFromSignedRequest(string $signedRequest)`
Returns a `Facebook\FacebookSession` for the given signed request.
</card>

<card>
## Instance Methods {#instance-methods}

### getToken {#gettoken}
`getToken()`
Returns the token string for the session.
### getSessionInfo {#getsessioninfo}
`getSessionInfo(string $appId = NULL, string $appSecret = NULL)`
Equivalent to calling the /debug_token endpoint of the Graph API to get the details for the access token for this session. Returns a `Facebook\GraphSessionInfo` object.
### getLongLivedSession {#getlonglivedsession}
`getLongLivedSession(string $appId = NULL, string $appSecret = NULL)`
Returns a new `Facebook\FacebookSession` resulting from extending a short-lived access token. This method will make a network request. If you know you already have a long-lived session, you do not need to call this. The only time you get a short-lived session as of March 2014 is from the Facebook SDK for JavaScript. If this session is not short-lived, this method will return `$this`. A long-lived session is on the order of months. A short-lived session is on the order of hours. You can figure out whether a session is short-lived or long-lived by checking the expiration date in the session info, but it's not a precise thing.
### getExchangeToken {#getexchangetoken}
`getExchangeToken(string $appId = NULL, string $appSecret = NULL)`
Returns an exchange token string which can be sent back to clients and exchanged for a device-linked access token. You need this when your user did not log in on a particular device, but you want to be able to make Graph API calls from that device as this user.
### validate {#validatei}
`validate(string $appId = NULL, string $appSecret = NULL)`
Ensures that a session is valid, throwing an exception if not. It does this by fetching the token info, ensuring the app ID in the token info matches the given (or default) app ID, ensuring the token itself is valid, and ensuring that the expiration time has not passed.
</card>
Loading