X-Git-Url: https://git.cweiske.de/grauphel.git/blobdiff_plain/381f04b7e408baccc64588a865bff33bcd87e152..e112e3a40594eb802ccb6549ad4329ae677f9e8d:/lib/oauth.php diff --git a/lib/oauth.php b/lib/oauth.php index 6900c20..231a177 100644 --- a/lib/oauth.php +++ b/lib/oauth.php @@ -103,7 +103,20 @@ class OAuth return OAUTH_PARAMETER_ABSENT; } - $token = $this->tokens->load('access', $provider->token); + try { + $token = $this->tokens->load('access', $provider->token); + } catch (OAuthException $e) { + if ($e->getCode() == OAUTH_TOKEN_REJECTED) { + return OAUTH_TOKEN_REJECTED; + } + throw $e; + } + + if (time() - $token->lastuse > 60) { + //time to update lastuse after at least a minute + $this->tokens->updateLastUse($token->tokenKey); + } + $provider->token_secret = $token->secret; return OAUTH_OK; } @@ -140,7 +153,7 @@ class OAuth /** * Get a new oauth provider instance. * Used to work around the fastcgi bug in oauthprovider. - * + * * @return \OAuthProvider */ public static function getProvider()