From e4066ae9600abe4974c0bfc1a30e39f41fa1b4c6 Mon Sep 17 00:00:00 2001 From: Step7750 Date: Mon, 23 Sep 2024 16:52:32 -0600 Subject: [PATCH] Fixes Refreshing Steam JWT Upon Fetch --- src/lib/alarms/access_token.ts | 4 ++++ src/lib/bridge/handlers/fetch_steam_user.ts | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lib/alarms/access_token.ts b/src/lib/alarms/access_token.ts index 469fd53..47212fa 100644 --- a/src/lib/alarms/access_token.ts +++ b/src/lib/alarms/access_token.ts @@ -20,6 +20,10 @@ export async function getAccessToken(expectedSteamID?: string): Promise( RequestType.FETCH_STEAM_USER, async (req) => { - const resp = await fetch('https://steamcommunity.com'); + const resp = await fetch('https://steamcommunity.com', { + headers: { + // Required for Steam to refresh the JWT when it expires + Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9;q=0.8,application/signed-exchange;v=b3;q=0.7', + }, + }); if (!resp.ok) { throw new Error('non-ok response for steamcommunity.com'); }