From 2250ee6aa6b80f8b65d4d3751554483db3a5d994 Mon Sep 17 00:00:00 2001 From: Aviv Eyal Date: Wed, 30 Oct 2013 17:19:46 -0700 Subject: [PATCH] Allow null for token expiration date Summary: At least under GitHub, the token value is stored as "null", and not missing. And `null > anything` is false, so Phabricator thinks the token is expired or not there. Test Plan: http://ph.vm/settings/panel/external/ before shows "No OAuth Access Token," and after it says "Active OAuth Token". Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley CC: Korvin, epriestley, aran Differential Revision: https://secure.phabricator.com/D7466 --- .../auth/provider/PhabricatorAuthProviderOAuth.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/applications/auth/provider/PhabricatorAuthProviderOAuth.php b/src/applications/auth/provider/PhabricatorAuthProviderOAuth.php index 415fb88e38..035c2d9adf 100644 --- a/src/applications/auth/provider/PhabricatorAuthProviderOAuth.php +++ b/src/applications/auth/provider/PhabricatorAuthProviderOAuth.php @@ -282,9 +282,9 @@ abstract class PhabricatorAuthProviderOAuth extends PhabricatorAuthProvider { // Don't return a token with fewer than this many seconds remaining until // it expires. $shortest_token = 60; - if ($access_token) { - if ($access_expires > (time() + $shortest_token)) { + if ($access_expires === null || + $access_expires > (time() + $shortest_token)) { return $access_token; } }