From 37b756abe1ab8da3aeaea774bae227fb1ecd0115 Mon Sep 17 00:00:00 2001 From: Sander Evers Date: Wed, 19 Oct 2016 16:17:10 +0200 Subject: [PATCH 1/2] convert expires_in to int before processing String concatenation is not what we want here. --- src/client-oauth2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client-oauth2.js b/src/client-oauth2.js index 995c6af..636def2 100644 --- a/src/client-oauth2.js +++ b/src/client-oauth2.js @@ -296,7 +296,7 @@ function ClientOAuth2Token (client, data) { this.accessToken = data.access_token this.refreshToken = data.refresh_token - this.expiresIn(data.expires_in) + this.expiresIn(parseInt(data.expires_in)) } /** From e4c028625248049ab03d13e088dbdd095e0482e8 Mon Sep 17 00:00:00 2001 From: Blake Embrey Date: Wed, 19 Oct 2016 11:07:24 -0700 Subject: [PATCH 2/2] Update client-oauth2.js --- src/client-oauth2.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client-oauth2.js b/src/client-oauth2.js index 636def2..444bc34 100644 --- a/src/client-oauth2.js +++ b/src/client-oauth2.js @@ -296,7 +296,7 @@ function ClientOAuth2Token (client, data) { this.accessToken = data.access_token this.refreshToken = data.refresh_token - this.expiresIn(parseInt(data.expires_in)) + this.expiresIn(data.expires_in) } /** @@ -308,7 +308,7 @@ function ClientOAuth2Token (client, data) { ClientOAuth2Token.prototype.expiresIn = function (duration) { if (!isNaN(duration)) { this.expires = new Date() - this.expires.setSeconds(this.expires.getSeconds() + duration) + this.expires.setSeconds(this.expires.getSeconds() + Number(duration)) } else { this.expires = undefined }