Facebook PHP SDK v5 - AccessToken expiration date
<p>I have two PHP files for making a login-link and receiving the access token (callback). My problem is, I cannot receive or get the expiration date of the access token.</p>

<p>This is my script for creating a link:</p>

<pre><code>&lt;?php
session_start();

define('FACEBOOK_SDK_V4_SRC_DIR', __DIR__ . '/facebook/');      
require_once __DIR__ . '/autoload.php';

$fb = new Facebook\Facebook( array('app_id' =&gt; 'XX', 'app_secret' =&gt; 'XX', 'default_graph_version' =&gt; 'v2.5'));

$permissions = ['email', 'user_likes', 'user_birthday', 'manage_pages ', 'user_photos', 'publish_actions', 'publish_pages' ];

$helper = $fb -&gt; getRedirectLoginHelper();
$loginUrl = $helper -&gt; getLoginUrl('blabla/facebook-login-callback.php', $permissions);

echo '&lt;a href="' . $loginUrl . '"&gt;Log in with Facebook!&lt;/a&gt;'; ?&gt;
</code></pre>

<p><strong>This works fine</strong>, my callback file is called.</p>

<pre><code>&lt;?php

session_start();

define('FACEBOOK_SDK_V4_SRC_DIR', __DIR__ . '/facebook/');
require __DIR__ . '/autoload.php';

$fb = new Facebook\Facebook(['app_id' =&gt; 'XX', 'app_secret' =&gt; 'XX', 'default_graph_version' =&gt; 'v2.5']);
$helper = $fb -&gt; getRedirectLoginHelper();

try {

    try {
        $accessToken = $helper -&gt; getAccessToken();

        $isexpired = $accessToken -&gt; isExpired();
        $expiresAt = $accessToken -&gt; getExpiresAt();

        echo "AccessToken: ";
        echo $accessToken -&gt; getValue();

        echo "&lt;br/&gt;ExpiresAt: ";
        echo $expiresAt;

        echo "&lt;br/&gt;IsExpired: ";
        echo $isexpired;

        die();

    } catch(Facebook\Exceptions\FacebookSDKException $e) {
        // There was an error communicating with Graph
        echo $e -&gt; getMessage();
        exit ;
    }
} catch(Facebook\Exceptions\FacebookResponseException $e) {
    // When Graph returns an error
    echo 'Graph returned an error: ' . $e -&gt; getMessage();
    exit ;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
    // When validation fails or other local issues
    echo 'Facebook SDK returned an error: ' . $e -&gt; getMessage();
    exit ;
} ?&gt;
</code></pre>

<p>BUT now my problem is, that I DONT get the expiration date as well as the 'isExpired' value, its just empty. The only thing I get is the access token as a string (by 'getValue()').</p>

<p>Can somebody help me? I think my code should be correct? </p>