Skip to content

fix: switch Steam web API token reading to cookies API - #425

Merged
Step7750 merged 2 commits into
masterfrom
fix/read-steam-token-from-cookie
Nov 29, 2026
Merged

Step7750 merged 2 commits into
masterfrom
fix/read-steam-token-from-cookie

Conversation

@Step7750

@Step7750 Step7750 commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Ref CSF-2340

Why

5.19.3 renewed the Steam store session to read the web API token from the store. On Firefox, the store can't refresh its own session after a steamcommunity.com login, since Firefox keeps the login cookie it needs out of the store's reach, so renewal fails there too.

What changed

The extension loads steamcommunity.com, which lets Steam refresh the login when needed, then reads the token from the steamLoginSecure cookie. This adds the cookies permission, which Chrome and Firefox don't warn about on update.

Expired tokens are rejected by checking exp against the Date header on Steam's response, since the user's clock can be off.

The 5.19.3 store renewal and its header rules are removed. Firefox still removes the old rule IDs, since dynamic rules survive updates.

Tests

Cover reading the cookie after the page load, account mismatches, missing cookies, expired tokens and a drifted local clock.


Note

Medium Risk
Changes how the extension obtains Steam web API credentials (cookies + session refresh), which affects all callers of getAccessToken, though the removed store renewal path was already failing on Firefox.

Overview
Replaces the Steam store session renewal flow (ajaxgetasyncconfig, jwt/ajaxrefresh, login/settoken) with loading steamcommunity.com so Steam can refresh the session, then reading the JWT from the steamLoginSecure cookie via the cookies permission.

Caching now tracks expires_at and only reuses tokens with more than 5 minutes left; expiry is checked against the response Date header so a wrong local clock or a stale cookie JWT is rejected. Firefox retries cookie lookup with firstPartyDomain when first-party isolation requires it.

The 5.19.3 store renewal DNR header rules and LAST_STORE_SESSION_RENEWAL_ATTEMPT storage are removed; Firefox still strips the old dynamic rule IDs on update.

Reviewed by Cursor Bugbot for commit 889fc99. Bugbot is set up for automated code reviews on this repo. Configure here.

@Step7750
Step7750 requested a review from GODrums November 26, 2026 23:28
Comment thread src/lib/alarms/access_token.ts Resolved
Comment thread src/lib/alarms/access_token.ts Resolved
@Step7750
Step7750 merged commit a59fb6f into master Nov 29, 2026
4 checks passed
@Step7750
Step7750 deleted the fix/read-steam-token-from-cookie branch November 29, 2026 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants