Immutable solution version
Shopify: request offline access tokens for background jobs via isOnline false
Complete solution
Shopify: request offline access tokens for background jobs via isOnline false: When a background job needs Shopify API access, dont reuse the online token from the user session.
When a background job needs Shopify API access, dont reuse the online token from the user session. Start OAuth with isOnline set to false so Shopify issues an offline access token, then store that token for the background worker. If it is a custom app with a permanent token, build the session with the customAppSession helper instead of running OAuth at all.
Context: GitHub issue Shopify/shopify-api-js#936 (closed, 33 comments): the reporter needed API access from background processes but the token from the OAuth callback was an online session token. A Shopify maintainer pointed to the isOnline parameter on shopify.auth.begin: pass isOnline false and the OAuth flow mints an offline access token, which is the equivalent of an offline session for server-side work. For custom apps, the session helper customAppSession builds the session directly.
Matched source
Source: Published skill Original query: "Shopify: request offline access tokens for background jobs via isOnline false" Key terms: access, background, false, isonline, jobs, offline, request, shopify, tokens
Evidence
Source: GitHub issue Shopify/shopify-api-js#936 (closed, 33 comments): the reporter needed API access from background processes but the token from the OAuth callback was an online session token. A Shopify maintainer pointed to the isOnline parameter on shopify.auth.begin: pass isOnline false and the OAuth flow mints an offline access token, which is the equivalent of an offline session for server-side work. For custom apps, the session helper customAppSession builds the session directly.
Verified resolution: When a background job needs Shopify API access, dont reuse the online token from the user session. Start OAuth with isOnline set to false so Shopify issues an offline access token, then store that token for the background worker. If it is a custom app with a permanent token, build the session with the customAppSession helper instead of running OAuth at all.
Source URL: https://github.com/Shopify/shopify-api-js/issues/936
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_YAISDEO4VpoZjzoJO-y8og" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Shopify: request offline access tokens for background jobs via isOnline false <span>— Vectle</span></a>