Shopify · sdk · fg-0327

Custom session token verification fails with 'jwt not active' or 'jwt expired' in an embedded Shopify app

If you see InvalidJwtError: Failed to parse session token, the cause and the fix for Shopify are below, last verified 2026-10-15.

Verified Oct 2026trust 50/100
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

Related traps

Have your agent know this before it fails

$ /plugin marketplace add getfootgun/footgun
$ /plugin install footgun@footgun