FacebookQueryBuilder
FacebookQueryBuilder copied to clipboard
"expires_at" bug?
I am just starting out with the Facebook API, so I am definitely just in the learning phase. I did find what seems to be a bug:
AccessToken.php > extend()
$expires_at = isset($data['expires_at']) ? $data['expires_at'] : 0;
should be
$expires_at = isset($data['expires']) ? $data['expires'] : 0;
If you look at $data that "expires" is the actual name of the key.
But even after I changed this it is still not converting the date correctly for the $token.
It is showing the expires_at date as public 'date' => string '1970-03-01 23:09:46.000000'
Oh, as to the date formatting, looks like the problem is facebook returns the 'expires' as a total seconds timestamp, and the function being used accepts UNIX timestamps, and it doesn't look like it is being correctly converted over.
Did you find any solution ?
What is the response you get when you call $token->getInfo()
For me $data variable only contains access_token in it.
Yes it looks like a bug.
You're right this is an issue that should be addressed. I fixed it in the official PHP SDK but forgot to back port it to FQB.
The thing is that depending on the way you obtain the access token, sometimes it will return expires
and other times is returns expires_at
. So both cases need to be accounted for. You can see the fix from the PHP SDK.
PS: Thanks for pointing out the issue @natenrb9! :)
In the response I'm getting from extend() $response = FQB::getConnection()->send('/oauth/access_token', 'GET', $params, $app_request = true);
It is returning "expires_in" which is 5184000 - 60 days