From 5ebd8c5a64071e8d4b6f1a20fdc0db6e9607792d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n?= <Zoltán@zolij-pc.lan>
Date: Thu, 17 Jul 2014 23:51:31 +0200
Subject: [PATCH] refresh token segitsegevel access token frissitese

---
 php/AuthSCHClient.class.php | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/php/AuthSCHClient.class.php b/php/AuthSCHClient.class.php
index f2636f9..8846680 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;
-- 
GitLab