From 68a8f25a70b26f6b92c214959f3e0c661e392c2f Mon Sep 17 00:00:00 2001 From: Rich Gowman Date: Wed, 4 Mar 2020 16:17:49 -0500 Subject: [PATCH 1/2] Fix revokeRefreshTokens to round consistently with the other platforms. This also makes it consistent with the comments a few lines above, as well as the integration test. --- src/auth/auth-api-request.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/auth/auth-api-request.ts b/src/auth/auth-api-request.ts index 8b3d521e31..17b14dba91 100755 --- a/src/auth/auth-api-request.ts +++ b/src/auth/auth-api-request.ts @@ -1041,7 +1041,7 @@ export abstract class AbstractAuthRequestHandler { const request: any = { localId: uid, // validSince is in UTC seconds. - validSince: Math.ceil(new Date().getTime() / 1000), + validSince: Math.floor(new Date().getTime() / 1000), }; return this.invokeRequestHandler(this.getAuthUrlBuilder(), FIREBASE_AUTH_SET_ACCOUNT_INFO, request) .then((response: any) => { From 9c501b0541bd2ae1c66e69bb9fc45e6b4966d12c Mon Sep 17 00:00:00 2001 From: Rich Gowman Date: Wed, 4 Mar 2020 16:27:19 -0500 Subject: [PATCH 2/2] Also fix unit tests to match --- test/unit/auth/auth-api-request.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/unit/auth/auth-api-request.spec.ts b/test/unit/auth/auth-api-request.spec.ts index 6c225b817a..ca880eb7a3 100755 --- a/test/unit/auth/auth-api-request.spec.ts +++ b/test/unit/auth/auth-api-request.spec.ts @@ -1955,8 +1955,8 @@ AUTH_REQUEST_HANDLER_TESTS.forEach((handler) => { it('should be fulfilled given a valid uid', () => { const requestData = { localId: uid, - // Current time should be passed, rounded up. - validSince: Math.ceil((now.getTime() + 5000) / 1000), + // Current time should be passed, rounded down. + validSince: Math.floor((now.getTime() + 5000) / 1000), }; const stub = sinon.stub(HttpClient.prototype, 'send').resolves(expectedResult); stubs.push(stub); @@ -1995,7 +1995,7 @@ AUTH_REQUEST_HANDLER_TESTS.forEach((handler) => { }); const requestData = { localId: uid, - validSince: Math.ceil((now.getTime() + 5000) / 1000), + validSince: Math.floor((now.getTime() + 5000) / 1000), }; const stub = sinon.stub(HttpClient.prototype, 'send').rejects(expectedServerError); stubs.push(stub);