- Symptom
- InvalidJwtError: Failed to parse session tokenjwt not activeRequests fail when a session token is reused after about a minute
- Cause
- Session tokens live for one minute and carry an nbf claim, so a server clock a few seconds behind rejects them and cached tokens expire quickly. The official library allows 10 seconds of clock skew, while hand-rolled jwt.verify calls allow none.
- Fix
- Fetch a fresh token with shopify.idToken() for every request, keep server time synced, and pass a small clock tolerance when verifying yourself.
- Apply
// client const token = await shopify.idToken() // server, jose await jwtVerify(token, key, { algorithms: ['HS256'], clockTolerance: 10, audience: process.env.SHOPIFY_API_KEY })- Affected
- Embedded Shopify apps using App Bridge session tokens; @shopify/shopify-api tolerates 10 s, custom verifiers often 0
- Sources
Last verified 2026-10-15 · Confirmed by 0 builders