diff --git a/CHANGELOG.md b/CHANGELOG.md index 767a26aeb..eab4161a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ - Remove HTTP server shutdown message. (#1457) - Add features to task queue functions. (#1423) - Add traces to V2 Firestore trigger logs. (#1440) +- Fix incorrectly parsed timestamps in auth blocking functions. (#1472) diff --git a/spec/common/providers/identity.spec.ts b/spec/common/providers/identity.spec.ts index 308845172..a5112b6c3 100644 --- a/spec/common/providers/identity.spec.ts +++ b/spec/common/providers/identity.spec.ts @@ -207,8 +207,8 @@ describe("identity", () => { describe("parseMetadata", () => { const decodedMetadata = { - last_sign_in_time: 1476235905, - creation_time: 1476136676, + last_sign_in_time: 1476235905000, + creation_time: 1476136676000, }; const metadata = { lastSignInTime: new Date(1476235905000).toUTCString(), @@ -374,8 +374,8 @@ describe("identity", () => { photo_url: "https://lh3.googleusercontent.com/1234567890/photo.jpg", tokens_valid_after_time: 1476136676, metadata: { - last_sign_in_time: 1476235905, - creation_time: 1476136676, + last_sign_in_time: 1476235905000, + creation_time: 1476136676000, }, custom_claims: { admin: true, @@ -632,8 +632,8 @@ describe("identity", () => { photo_url: "https://lh3.googleusercontent.com/1234567890/photo.jpg", tokens_valid_after_time: 1476136676, metadata: { - last_sign_in_time: 1476235905, - creation_time: 1476136676, + last_sign_in_time: 1476235905000, + creation_time: 1476136676000, }, custom_claims: { admin: true, diff --git a/src/common/providers/identity.ts b/src/common/providers/identity.ts index 9997d7569..b90c5b549 100644 --- a/src/common/providers/identity.ts +++ b/src/common/providers/identity.ts @@ -489,10 +489,10 @@ function unsafeDecodeAuthBlockingToken(token: string): DecodedPayload { */ export function parseMetadata(metadata: DecodedPayloadUserRecordMetadata): AuthUserMetadata { const creationTime = metadata?.creation_time - ? new Date(metadata.creation_time * 1000).toUTCString() + ? new Date(metadata.creation_time).toUTCString() : null; const lastSignInTime = metadata?.last_sign_in_time - ? new Date(metadata.last_sign_in_time * 1000).toUTCString() + ? new Date(metadata.last_sign_in_time).toUTCString() : null; return { creationTime,