Skip to content

fix(ts,py,rust): refresh web-fallback sessions with the correct key (v2.2.1) - #105

Merged
ekkx merged 1 commit into
masterfrom
fix/web-session-oauth-refresh-key-ports
Jul 4, 2026
Merged

fix(ts,py,rust): refresh web-fallback sessions with the correct key (v2.2.1)#105
ekkx merged 1 commit into
masterfrom
fix/web-session-oauth-refresh-key-ports

Conversation

@ekkx

@ekkx ekkx commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

Ports the Go v2.2.1 fix to TypeScript, Python and Rust, bringing all four languages to v2.2.1.

A session established via the alternate login endpoint is issued under the web API key, so its OAuth token refresh (POST /api/v1/oauth/token, Authorization: Basic base64(key)) must use that same key — refreshing with the app key returns 401.

Fix (identical across languages)

  • Track the key that established the active session as mutable client state (app key by default; web key for a fallback session; a caller-pinned key otherwise).
  • Use it as the Basic credential wherever the OAuth token endpoint is hit (transport header injection + the bespoke refresh call).
  • Persist it in the session as oauth_key (omitted for default app sessions so their files stay byte-identical) and restore it on a cache hit.
  • Signing (signed_info) stays on the app key — only the OAuth Basic credential is session-scoped.

Tests

Each language's auth suite gains three refresh scenarios: web session refreshes with the web key, app session with the app key (no oauth_key persisted), restored web session with the web key. Rust/Python drive a real refresh round-trip through an oauth mock that only accepts the expected key; TS captures the Authorization header. Full suites green (Python, TypeScript, Rust).

Version

TypeScript / Python / Rust bumped to 2.2.1. Contract in PORTING.md 6.2.

…v2.2.1)

Port the Go v2.2.1 fix to TypeScript, Python and Rust: a session
obtained via the alternate login endpoint is issued under the web API
key, so its OAuth token refresh must use that key for the Basic
credential — refreshing with the app key 401s.

Each SDK now tracks the key that established the session, uses it as the
OAuth Basic credential (header injection + refresh), persists it in the
session (omitted for default app sessions) and restores it on a cache
hit. Signing is unaffected and keeps using the app key. Brings TS / Py /
Rust to v2.2.1, matching Go. Contract in PORTING.md 6.2.
@ekkx
ekkx merged commit 3effa0a into master Jul 4, 2026
14 checks passed
@ekkx
ekkx deleted the fix/web-session-oauth-refresh-key-ports branch July 4, 2026 06:16
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