Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AccessToken setTimeNow is useless function #1012

Open
androidealp opened this issue Oct 13, 2023 · 0 comments
Open

AccessToken setTimeNow is useless function #1012

androidealp opened this issue Oct 13, 2023 · 0 comments

Comments

@androidealp
Copy link

androidealp commented Oct 13, 2023

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....
     }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant