From 839d8b51e3ec74d977b07218f221c18bf9e6e09c Mon Sep 17 00:00:00 2001 From: Alexander Corn Date: Sat, 2 Apr 2016 16:14:34 -0400 Subject: [PATCH] Automatically handle time offset when enabling 2FA (fixes #98) --- components/twofactor.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/components/twofactor.js b/components/twofactor.js index 4a2057a..651c691 100644 --- a/components/twofactor.js +++ b/components/twofactor.js @@ -61,7 +61,15 @@ SteamCommunity.prototype.finalizeTwoFactor = function(secret, activationCode, ca return; } - finalize(token); + SteamTotp.getTimeOffset(function(err, offset, latency) { + if (err) { + callback(err); + return; + } + + diff = offset; + finalize(token); + }); }); function finalize(token) {