Skip to content

Commit 224f65f

Browse files
authored
Fix revokeRefreshTokens to round consistently with the other platforms. (#801)
This also makes it consistent with the comments a few lines above, as well as the integration test.
1 parent d83daa6 commit 224f65f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/auth/auth-api-request.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ export abstract class AbstractAuthRequestHandler {
10411041
const request: any = {
10421042
localId: uid,
10431043
// validSince is in UTC seconds.
1044-
validSince: Math.ceil(new Date().getTime() / 1000),
1044+
validSince: Math.floor(new Date().getTime() / 1000),
10451045
};
10461046
return this.invokeRequestHandler(this.getAuthUrlBuilder(), FIREBASE_AUTH_SET_ACCOUNT_INFO, request)
10471047
.then((response: any) => {

test/unit/auth/auth-api-request.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1955,8 +1955,8 @@ AUTH_REQUEST_HANDLER_TESTS.forEach((handler) => {
19551955
it('should be fulfilled given a valid uid', () => {
19561956
const requestData = {
19571957
localId: uid,
1958-
// Current time should be passed, rounded up.
1959-
validSince: Math.ceil((now.getTime() + 5000) / 1000),
1958+
// Current time should be passed, rounded down.
1959+
validSince: Math.floor((now.getTime() + 5000) / 1000),
19601960
};
19611961
const stub = sinon.stub(HttpClient.prototype, 'send').resolves(expectedResult);
19621962
stubs.push(stub);
@@ -1995,7 +1995,7 @@ AUTH_REQUEST_HANDLER_TESTS.forEach((handler) => {
19951995
});
19961996
const requestData = {
19971997
localId: uid,
1998-
validSince: Math.ceil((now.getTime() + 5000) / 1000),
1998+
validSince: Math.floor((now.getTime() + 5000) / 1000),
19991999
};
20002000
const stub = sinon.stub(HttpClient.prototype, 'send').rejects(expectedServerError);
20012001
stubs.push(stub);

0 commit comments

Comments
 (0)