Skip to content

fix(auth): use expiring offline tokens - #24

Merged
arsalan-arshad merged 1 commit into
mainfrom
fix/expiring-offline-token
Nov 5, 2026
Merged

arsalan-arshad merged 1 commit into
mainfrom
fix/expiring-offline-token

Conversation

@arsalan-arshad

Copy link
Copy Markdown
Owner

Summary

  • Implements Shopify's mandated expiring offline access tokens (expiring: 1) for public apps calling the Admin API.
  • Stores AES-256-GCM encrypted accessToken with expiration timestamp (expires) in Session.
  • Leaves refreshToken and refreshTokenExpires NULL (zero refresh tokens stored at rest).
  • Automatically re-exchanges tokens using the fresh App Bridge id_token on embedded-admin requests when a session is missing, has NULL expires, or expires within 5 minutes.
  • No separate refresh worker/flow needed since the app makes no Admin API calls outside embedded merchant admin requests.
  • Immediately invokes syncShopProfile with the newly minted token, logs non-OK response error snippets up to 200 chars, and ensures fallback lookups only use valid tokens.
  • Updates documentation and privacy text to honestly reflect short-lived token lifecycle.

Verified:

  • npm test: 580 passed, 0 failed across 132 suites.
  • npm run test:all: 591 tests (580 passed, 11 skipped live DB).

Unverified:

  • Live sync against a real store.

@arsalan-arshad
arsalan-arshad merged commit c346a02 into main Nov 5, 2026
1 check passed
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