AccessToken setTimeNow is useless function
androidealp opened this issue · comments
André Luiz Pereira commented
token depends on the expiration date, currently the self::$timeNow attribute is null so getTimeNow() returns the current time() and not the one determined by the auth token.
my Solution:
public function checkExpires(AccessToken $accessToken, $tokenObject){
$expires = $accessToken->getTimeNow() + $tokenObject['expires_in'];
return ($expires < time());
}
public function myCode($accessToken, $tokenObject, $bdTokenObject){
$accessToken->setTimeNow($bdTokenObject->dt_create);
if($this->checkExpires($accessToken, $tokenObject)){
// token expired....
}
}