From 01318370d423e4b8d7f87f3903e858b7fcce4835 Mon Sep 17 00:00:00 2001 From: Karim Hamidou Date: Thu, 6 Apr 2017 18:54:10 -0700 Subject: [PATCH] [cloud-workers] [send-later] Fix send later token expiration Summary: Fixes T8076. So, the Gmail OAuth API returns us an expiration time in milliseconds, but we convert it to seconds everywhere, except in the cloud-api. This caused us to never refresh tokens because we'd be comparing seconds to milliseconds. Fix this by converting the `expiry_date` from our credentials to seconds. Test Plan: Tested manually. Will do more testing tomorrow, after my credentials expire. Reviewers: evan, juan Reviewed By: evan, juan Maniphest Tasks: T8076 Differential Revision: https://phab.nylas.com/D4390 --- packages/isomorphic-core/src/auth-helpers.es6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/isomorphic-core/src/auth-helpers.es6 b/packages/isomorphic-core/src/auth-helpers.es6 index 308dd9990..4454bd1fc 100644 --- a/packages/isomorphic-core/src/auth-helpers.es6 +++ b/packages/isomorphic-core/src/auth-helpers.es6 @@ -60,7 +60,7 @@ export function googleSettings(googleToken, email) { smtp_username: email, }, CommonProviderSettings.gmail); const connectionCredentials = { - expiry_date: googleToken.expiry_date, + expiry_date: Math.floor(googleToken.expiry_date / 1000), }; if (GMAIL_CLIENT_ID && GMAIL_CLIENT_SECRET) { // cloud-only credentials