diff --git a/php/AuthSCHClient.class.php b/php/AuthSCHClient.class.php index f2636f9b482996383f8e52a6817c547d72b598e5..884668055dc0668e269156dbfe0742789988caf0 100644 --- a/php/AuthSCHClient.class.php +++ b/php/AuthSCHClient.class.php @@ -30,10 +30,12 @@ class AuthSCHClient { } else { // load tokendata from session $this->tokens = unserialize($_SESSION['tokens']); - if($this->tokens->lastUpdate + 3600 < time()) { - $this->reauthenticate(); - $_SESSION['tokens'] = serialize($this->tokens); - } + } + + //refresh access token if it!s too old + if($this->tokens->lastUpdate + 3600 < time()) { + $this->reauthenticate(); + $_SESSION['tokens'] = serialize($this->tokens); } } else { $this->tokens = $tokens;