[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
This commit is contained in:
Karim Hamidou 2017-04-06 18:54:10 -07:00
parent 236c71ea6a
commit 01318370d4

View file

@ -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