From fece5365f500aa67b691558ee73f9f1215df0b6b Mon Sep 17 00:00:00 2001 From: raevilman <8374679+raevilman@users.noreply.github.com> Date: Wed, 13 Mar 2024 21:37:00 +0530 Subject: [PATCH 1/3] add issued_at, expiration_time to the DecodedGoogleUser --- src/utils/account.ts | 2 ++ src/utils/types.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/utils/account.ts b/src/utils/account.ts index 3c4a959..71e5e6c 100644 --- a/src/utils/account.ts +++ b/src/utils/account.ts @@ -41,5 +41,7 @@ export function decodeCredential(credential: string): DecodedGoogleUser { name: decodedToken.name, picture: decodedToken.picture, id: decodedToken.sub, + issued_at: decodedToken.iat, + expiration_time: decodedToken.exp, }; } diff --git a/src/utils/types.ts b/src/utils/types.ts index ce58e9c..2db3dc9 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -11,4 +11,6 @@ export interface DecodedGoogleUser { name: string; id: string; picture: string; + issued_at: number; + expiration_time: number; } From 8d647a97cf627bdd290642b44484702c5011a060 Mon Sep 17 00:00:00 2001 From: raevilman <8374679+raevilman@users.noreply.github.com> Date: Wed, 13 Mar 2024 22:15:00 +0530 Subject: [PATCH 2/3] updates documentation and renames expiration_at to expires_at --- docs/helpers/snippets/decodeCredentialResponse.json | 4 +++- src/utils/account.ts | 2 +- src/utils/types.ts | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/helpers/snippets/decodeCredentialResponse.json b/docs/helpers/snippets/decodeCredentialResponse.json index 70e988f..4f06f97 100644 --- a/docs/helpers/snippets/decodeCredentialResponse.json +++ b/docs/helpers/snippets/decodeCredentialResponse.json @@ -6,5 +6,7 @@ "family_name": "Smith", "given_name": "John", "id": "3141592653589793238", // The unique ID of the user's Google Account - "picture": "https://lh3.googleusercontent.com/a-/e2718281828459045235360uler" + "picture": "https://lh3.googleusercontent.com/a-/e2718281828459045235360uler", + "issued_at": 1590000000, // The time the ID token was issued, in seconds since the Unix epoch + "expires_at": 1590003600 // The time the ID token expires, in seconds since the Unix epoch } diff --git a/src/utils/account.ts b/src/utils/account.ts index 71e5e6c..92e0aee 100644 --- a/src/utils/account.ts +++ b/src/utils/account.ts @@ -42,6 +42,6 @@ export function decodeCredential(credential: string): DecodedGoogleUser { picture: decodedToken.picture, id: decodedToken.sub, issued_at: decodedToken.iat, - expiration_time: decodedToken.exp, + expires_at: decodedToken.exp, }; } diff --git a/src/utils/types.ts b/src/utils/types.ts index 2db3dc9..a202e7d 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -12,5 +12,5 @@ export interface DecodedGoogleUser { id: string; picture: string; issued_at: number; - expiration_time: number; + expires_at: number; } From b9d8f2c881878020331af695aba76c41f8f7ad5b Mon Sep 17 00:00:00 2001 From: raevilman <8374679+raevilman@users.noreply.github.com> Date: Fri, 26 Apr 2024 13:00:28 +0530 Subject: [PATCH 3/3] use iat and exp for the field names --- docs/helpers/snippets/decodeCredentialResponse.json | 4 ++-- src/utils/account.ts | 4 ++-- src/utils/types.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/helpers/snippets/decodeCredentialResponse.json b/docs/helpers/snippets/decodeCredentialResponse.json index 4f06f97..4f11708 100644 --- a/docs/helpers/snippets/decodeCredentialResponse.json +++ b/docs/helpers/snippets/decodeCredentialResponse.json @@ -7,6 +7,6 @@ "given_name": "John", "id": "3141592653589793238", // The unique ID of the user's Google Account "picture": "https://lh3.googleusercontent.com/a-/e2718281828459045235360uler", - "issued_at": 1590000000, // The time the ID token was issued, in seconds since the Unix epoch - "expires_at": 1590003600 // The time the ID token expires, in seconds since the Unix epoch + "iat": 1590000000, // The time the ID token was issued, in seconds since the Unix epoch + "exp": 1590003600 // The time the ID token expires, in seconds since the Unix epoch } diff --git a/src/utils/account.ts b/src/utils/account.ts index 92e0aee..d16de21 100644 --- a/src/utils/account.ts +++ b/src/utils/account.ts @@ -41,7 +41,7 @@ export function decodeCredential(credential: string): DecodedGoogleUser { name: decodedToken.name, picture: decodedToken.picture, id: decodedToken.sub, - issued_at: decodedToken.iat, - expires_at: decodedToken.exp, + iat: decodedToken.iat, + exp: decodedToken.exp, }; } diff --git a/src/utils/types.ts b/src/utils/types.ts index a202e7d..453bf9f 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -11,6 +11,6 @@ export interface DecodedGoogleUser { name: string; id: string; picture: string; - issued_at: number; - expires_at: number; + iat: number; + exp: number; }