diff --git a/src/backend/gardenGate/getServiceAccountIdToken.ts b/src/backend/gardenGate/getServiceAccountIdToken.ts index 7fe1d678..e8e5a7f5 100644 --- a/src/backend/gardenGate/getServiceAccountIdToken.ts +++ b/src/backend/gardenGate/getServiceAccountIdToken.ts @@ -6,7 +6,11 @@ export const getServiceAccountIdToken = async ( audience: string, credentialPath: string ) => { - const cachedToken = await readFileSystem(['googleIdToken', audience]) + const cachedToken = await readFileSystem([ + 'googleIdToken', + audience, + credentialPath, + ]) if (cachedToken !== null) return cachedToken.data @@ -18,7 +22,11 @@ export const getServiceAccountIdToken = async ( // each token has a lifespan of 1 hour const token = await client.fetchIdToken(audience) - // allow caching token for 30 minutes, preventing spaming to google cloud - await writeFileSystem(['googleIdToken', audience], token, 30 * 60 * 1000) + // allow caching token for 30 minutes, preventing spamming to google cloud + await writeFileSystem( + ['googleIdToken', audience, credentialPath], + token, + 30 * 60 * 1000 + ) return token }