Skip to content

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

Open
Step7750 wants to merge 1 commit into
masterfrom
fix/read-steam-token-from-cookie
Open

Step7750 wants to merge 1 commit 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 auth tokens are obtained for trade pings and related features; misread or expired cookies could break Steam API calls until the user revisits Steam, but the flow is simpler and avoids brittle store renewal on Firefox.

Overview
Steam Web API tokens are no longer fetched via the store (ajaxgetasyncconfig) or renewed through jwt/ajaxrefresh / settoken. The extension now loads steamcommunity.com (so Steam can refresh the session), reads the JWT from the steamLoginSecure cookie via the new cookies permission, and rejects tokens whose exp is past Steam's time using the response Date header.

Store-session renewal code, LAST_STORE_SESSION_RENEWAL_ATTEMPT, and declarative-net-request rules that spoofed store headers for refresh/settoken are removed; Firefox dynamic rules still drop the old renewal rule IDs on update. Tests are rewritten around cookie reads and expiry checks instead of store renewal flows.

Reviewed by Cursor Bugbot for commit 3688134. 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
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.

1 participant