FacebookQueryBuilder icon indicating copy to clipboard operation
FacebookQueryBuilder copied to clipboard

"expires_at" bug?

Open natenrb9 opened this issue 10 years ago • 6 comments

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'

natenrb9 avatar Jan 30 '15 19:01 natenrb9

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.

natenrb9 avatar Jan 30 '15 20:01 natenrb9

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.

jdsingh avatar Jan 31 '15 09:01 jdsingh

Yes it looks like a bug.

jdsingh avatar Jan 31 '15 10:01 jdsingh

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.

SammyK avatar Feb 02 '15 20:02 SammyK

PS: Thanks for pointing out the issue @natenrb9! :)

SammyK avatar Feb 02 '15 20:02 SammyK

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

phazei avatar Jul 25 '15 04:07 phazei