Brandbrand
Book a call
Close-up of Shopify theme Liquid code on a dark screen

Expiring access tokens in Shopify apps: what changes

Shopify apps no longer get an access key that is valid forever. What changes, which dates matter for your store, and how we built it into our Laravel apps.

What an access token is

An app that reads orders, products or customers in your store does so with an access token: a key Shopify gives the app on install. An "offline" token is the key the app uses when nobody is logged in, for example to update stock at night.

Until now, such an offline token stayed valid as long as the app was installed. If it leaked, through a hacked server or a database dump, a stranger had access to your store until someone noticed.

What changes

An expiring offline token is valid for one hour. The app also gets a refresh token, valid for 90 days. With it, the app asks for a new pair in time. A leaked token is worthless after an hour.

The dates, according to Shopify's own guide:

  • 1 April 2026. New public apps must use expiring tokens.
  • 1 December 2026. The same goes for new custom apps and apps a merchant builds themselves. Older custom apps may keep their token.
  • 1 January 2027. Public apps that have not moved over are removed from the App Store and can no longer be newly installed. Existing installs keep working.
  • 15 January 2027. Merchants see a warning in their Shopify admin for apps that have not moved over.
  • 1 April 2027. Shopify rejects every request with an old token. The app then stops working in your store.

How we ran into it

In October we put a new public app live. On the first production install, every call to the Admin API returned a 403, with the message "Non-expiring access tokens are no longer accepted for the Admin API."

The fix came in two steps, the way Shopify describes it. First the app swaps a stored old token for an expiring pair on first use. A day later the app asked for an expiring token on every install right away, so a store never gets an old token again. The library we used could not do that last part, so we wrote that step ourselves, with tests.

Moving an app over

  1. Send expiring=1 when the app requests a token, on install or re-authorization. New stores get an expiring pair straight away.
  2. Swap existing old tokens through token exchange. The old token is then invalid for good, the merchant does nothing.
  3. Refresh the token before it expires. Every time a new pair comes back: store both.
  4. If the refresh token expires anyway, have the merchant open the app again. That gives a new pair.
// One refresh at a time per store: every refresh returns a new pair.
public function forShop(string $shop): string
{
    $session = Session::forShop($shop);
    if ($session->access_token_expires_at->gt(now()->addMinutes(5))) {
        return $session->access_token;
    }

    return Cache::lock("shopify-token:$shop", 30)->block(10, function () use ($shop) {
        $session = Session::forShop($shop);
        $pair = Http::asForm()->post("https://$shop/admin/oauth/access_token", [
            'client_id' => config('shopify.key'),
            'client_secret' => config('shopify.secret'),
            'grant_type' => 'refresh_token',
            'refresh_token' => $session->refresh_token,
        ])->throw()->json();

        $session->update([
            'access_token' => $pair['access_token'],
            'refresh_token' => $pair['refresh_token'],
            'access_token_expires_at' => now()->addSeconds($pair['expires_in']),
        ]);

        return $pair['access_token'];
    });
}
app/Services/Shopify/OfflineAccessTokens.php

Where it goes wrong

  • Two refreshes at once. A queue job and a webhook refreshing at the same moment each get a different pair. Shopify advises one refresh at a time per store. We do that with a lock per store.
  • Storing only the access token. The refresh token rotates with every refresh. If you don't store the new one, the old one keeps working for a while and then stops.
  • Treating every error as final. A timeout or a 5xx from Shopify is temporary: retry with the same refresh token. Only a 401 means the merchant has to open the app again.
  • Swapping with no way back. Token exchange makes the old token invalid for good. Run it on a development store first.

What this means for you

  • Using apps from the App Store? Then you don't need to do anything yourself. If you see a warning on an app from 15 January, ask its maker when they will move over. After 1 April 2027 that app will otherwise stop working.
  • Have your own public app? It has to move before 1 January 2027, or nobody can install it anymore.
  • Have a custom app from before 1 December 2026? It may keep its token. Moving over is still safer, especially if the app reads customer data.

Frequently asked questions

Does the merchant have to reinstall the app?

No. The app swaps the old token itself. Only if a refresh token expires does the merchant have to open the app once more.

Does this apply to online tokens too?

No. Online tokens, for a logged-in staff member, already expired after 24 hours. This is only about offline tokens.

Does the Shopify library do this by itself?

Shopify's official app templates do, with one setting. If you build in PHP or Laravel, check whether your library sends expiring=1. Ours did not.