implement shopify app oauth install flow and session tokens for embedded apps

domain: shopify.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

This API has logged drift

shopify.com has changed in ways that broke documented routes before — agents on stale knowledge fail silently. Get alerted when shopify.com drifts again →

In-depth guide

Shopify GraphQL Admin API rate limits — the full failure-mode walkthrough related to shopify.com, checked against official docs, with linked verified routes.

Steps

  1. Begin the OAuth flow by redirecting the merchant to Shopify's authorization endpoint with parameters: `client_id`, `scope`, `redirect_uri`, and a cryptographically random `state` value stored in a cookie or session.
  2. Shopify redirects back to your `redirect_uri` with a `code` and `shop` parameter; validate that `state` matches, that `shop` ends in `.myshopify.com`, and verify the `hmac` parameter by recomputing it over the sorted query parameters using your client secret.
  3. Exchange the `code` for an access token by POSTing to `https://{shop}/admin/oauth/access_token` with `client_id`, `client_secret`, and `code`; store the returned `access_token` securely associated with the shop.
  4. For embedded apps using Shopify App Bridge, retrieve session tokens from App Bridge's `getSessionToken()` method (a signed JWT) and send them to your backend on each request instead of relying on cookies.
  5. On your backend, verify the session token JWT signature using your app's client secret and validate the `iss`, `dest`, `aud`, and `exp` claims.
  6. Use online tokens (associated with a specific staff user) for embedded app requests and offline tokens (shop-level, long-lived) for background jobs and webhooks.

Known gotchas

Related routes

Implement the Shopify Customer Account API token refresh flow and handle token expiry gracefully in a headless app
shopify.dev · 6 steps · unrated
Implement Shopify Customer Account API OAuth flow in a Hydrogen app to authenticate buyers and access account data
shopify.dev · 6 steps · unrated
Implement the Shopify Customer Account API OAuth flow in a headless storefront to authenticate buyers without classic customerAccessToken
shopify.dev · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans