Shopify App Connections: Understanding the Shift from Permanent to Expiring Tokens

Hey there, fellow store owners! Let's talk about something a bit technical today, but trust me, it's super important for how your favorite Shopify apps stay connected and working smoothly. You might not see it directly, but behind the scenes, there's a big shift happening with how apps maintain their access to your store's data. We're moving from 'permanent' tokens to 'expiring' ones, and a recent discussion in the Shopify community brought up a really critical point about this transition.

The Big Change: Expiring Tokens Are the New Standard

For years, many Shopify apps used what were called 'permanent' or 'non-expiring' offline tokens. These tokens, once granted, pretty much lasted forever unless you uninstalled the app. Super convenient, right? Well, for security and best practices, Shopify is transitioning all apps to use 'expiring' offline tokens. This means tokens will have a lifespan, and apps will need to regularly 'refresh' them to keep their connection alive.

There's a hard deadline for this: January 1, 2027. After this date, any apps still trying to use those old permanent tokens will find them invalidated. So, every app developer out there has to migrate their existing app installations to this new token system.

A Community Deep Dive: Uncovering a Migration Glitch

This is where our community discussion comes in. A sharp app developer, SherwinSB, kicked off a thread asking a really insightful question: "Can Permanent-to-Expiring Offline Token Migration Have the Same Recovery Window as Refresh Token Rotation?"

Now, that's a mouthful, but here's the gist: When an app refreshes an *already expiring* token, Shopify has a clever safety net. If the app gets a new token but then fails to save it, the *old* token remains valid for a little while. This gives the app a chance to recover and try again without breaking the connection.

SherwinSB's testing, backed up by other community members like Mustafa_Ali and Joshua827, revealed something crucial about the *migration* process (going from permanent to expiring tokens): this safety net doesn't apply!

Here's what SherwinSB found in their tests:

# old forever token still works

curl -X POST "https://sherwins-shop.myshopify.com/admin/api/2025-10/graphql.json" 
-H "Content-Type: application/json" 
-H "X-Shopify-Access-Token: shpat_1083..." 
-d '{\"query\":\"{ shop { name } }\"}'

# {\"data\":{\"shop\":{\"name\":\"Sherwin's Shop\"}}, ...}

# migrate

curl -X POST "https://sherwins-shop.myshopify.com/admin/oauth/access_token" 
-H "Content-Type: application/x-www-form-urlencoded" 
-d "client_id=...&client_secret=...&grant_type=urn:ietf:params:oauth:grant-type:token-exchange&subject_token=shpat_1083...&subject_token_type=urn:shopify:params:oauth:token-type:offline-access-token&requested_token_type=urn:shopify:params:oauth:token-type:offline-access-token&expiring=1"

# {\"access_token\":\"shpat_fd...\",\"expires_in\":3599,\"refresh_token\":\"shprt_d9e...\",\"refresh_token_expires_in\":7775999}

# same old token, we never used the new shpat_

curl -X POST "https://sherwins-shop.myshopify.com/admin/api/2025-10/graphql.json" 
-H "Content-Type: application/json" 
-H "X-Shopify-Access-Token: shpat_1083..." 
-d '{\"query\":\"{ shop { name } }\"}'

# {\"errors\":\"[API] Invalid API key or access token (unrecognized login or wrong password)\"}

As you can see from the code block, the original permanent token (shpat_1083...) worked just fine. After the migration exchange, *without even using the new token*, trying to use the old one again immediately resulted in an "Invalid API key or access token" error. It was "already dead."

Why This Matters to Your Store: The "Broken App" Window

This immediate invalidation creates what the community called a "window of exposure." Here's the scenario:

  • Your app successfully exchanges your store's old permanent token for a new expiring one.
  • BUT, for some reason (a database hiccup, a server crash), your app fails to save this brand-new expiring token correctly.
  • Result: Your store's connection to that app is now broken. All background jobs, webhooks, and automated tasks the app performs for you will stop working.

The crucial part? The only way to recover this connection is for *you*, the merchant, to manually open the app again in your Shopify admin. This re-triggers the authentication flow, allowing the app to get a new token. If your app primarily does background work and you don't open it frequently, this "broken app" window could last for weeks, causing significant disruption to your operations without you even realizing it immediately.

What App Developers Are Doing (and What You Should Expect)

The good news is that smart app developers are well aware of this and are building robust solutions. Based on the community's insights, here are the key strategies apps should be employing to ensure a smooth transition for your store:

Robust Migration Protocols

  • "Atomic" Operations: Apps should treat each store's token migration as a single, unbreakable operation. This means the new token *must* be successfully saved to their database *before* they consider the migration complete for your store.
  • Save First, Then Confirm: The new token pair should be both *received AND successfully persisted* before the app marks your shop as migrated. If there's a crash between receiving and saving, the app should be able to retry cleanly.
  • Immediate Validation: After getting a new token, the app should immediately make a quick API call using that *new* token. This confirms it's valid and working, catching any issues right away.

Smart Error Handling and Recovery

  • Listening for 401s: Apps should be constantly monitoring for 401 Unauthorized errors from Shopify's API during *any* API call. This is the definitive signal that a token is invalid and re-authentication is needed.
  • Prioritizing Active Stores: For apps migrating many stores, it makes sense to prioritize those most recently visited by merchants. This reduces the "window of exposure" for stores that are actively managed.

Advocacy for a Better Solution

Many in the developer community, including SherwinSB, believe Shopify could improve this migration process by adding a similar recovery window or a grace period for permanent tokens. If you're an app developer, flagging this scenario to Shopify's dev support can help push for these improvements.

For you, the store owner, it's a good reminder that your app developers are working hard behind the scenes to keep things running. While this token migration is a critical security enhancement, it does introduce a specific technical challenge that requires careful handling by app developers. If you ever notice an app that used to perform background tasks suddenly stops working, and you haven't uninstalled it, the first troubleshooting step is often to simply navigate to the app within your Shopify admin and open it. This often re-initiates the connection and gets things back on track. It's a testament to the ongoing evolution of the Shopify platform and the dedication of the developer community to keep your stores running smoothly.

Share:

Start with the tools

Explore migration tools

See options, compare methods, and pick the path that fits your store.

Explore migration tools