Skip to content

Commit

Permalink
Merge pull request #68 from raevilman/enhance-decoded-google-user
Browse files Browse the repository at this point in the history
add issued_at, expires_at to the DecodedGoogleUser
  • Loading branch information
kasvith authored May 7, 2024
2 parents 6841a16 + b9d8f2c commit 7c15d7d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/helpers/snippets/decodeCredentialResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
"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
}
2 changes: 2 additions & 0 deletions src/utils/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,7 @@ export function decodeCredential(credential: string): DecodedGoogleUser {
name: decodedToken.name,
picture: decodedToken.picture,
id: decodedToken.sub,
iat: decodedToken.iat,
exp: decodedToken.exp,
};
}
2 changes: 2 additions & 0 deletions src/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ export interface DecodedGoogleUser {
name: string;
id: string;
picture: string;
iat: number;
exp: number;
}

0 comments on commit 7c15d7d

Please sign in to comment.