From dce52c26d80c7216b103ff2b239900c53762305c Mon Sep 17 00:00:00 2001 From: Nicolas Le Goff Date: Wed, 12 Mar 2014 16:01:45 +0100 Subject: [PATCH] Add proper expire date to oauth code token --- lib/classes/API/OAuth2/Adapter.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/classes/API/OAuth2/Adapter.php b/lib/classes/API/OAuth2/Adapter.php index b5da9a0b08..e84beb3d01 100644 --- a/lib/classes/API/OAuth2/Adapter.php +++ b/lib/classes/API/OAuth2/Adapter.php @@ -297,6 +297,11 @@ class API_OAuth2_Adapter extends OAuth2 } $expires = null !== $expires ? \DateTime::createFromFormat('U', $expires) : null; + // @note stored date time are not UTC ... and expires parameter is a UNIX timestamp which is timezone independent + if ($expires instanceof \DateTime) { + $dtz = new \DateTimeZone(date_default_timezone_get()); + $expires->add(new \DateInterval('PT' . $dtz->getOffset($expires) . 'S')); + } $code = $this->app['manipulator.api-oauth-code']->create($account, $redirectUri, $expires, $scope); $this->app['manipulator.api-oauth-code']->setCode($code, $oauthCode);