Skip to content

feat: Laravel 13 support + Shopify expiring offline tokens fix - #476

Closed
Haseeb9229 wants to merge 4 commits into
Kyon147:masterfrom
Haseeb9229:feature/laravel-13-expiring-tokens
Closed

feat: Laravel 13 support + Shopify expiring offline tokens fix#476
Haseeb9229 wants to merge 4 commits into
Kyon147:masterfrom
Haseeb9229:feature/laravel-13-expiring-tokens

Conversation

@Haseeb9229

Copy link
Copy Markdown
  • composer.json: add Laravel ^13.0 to framework version constraint
  • ApiHelper: override getAccessData() to POST with expiring=1 so Shopify returns short-lived access_token (1hr) + refresh_token (90 days)
  • ApiHelper: add refreshAccessToken() method to exchange refresh token
  • ApiHelper contract: add refreshAccessToken() to IApiHelper interface
  • InstallShop: persist refresh_token, token_expires_at and refresh_token_expires_at after OAuth completes
  • Migration: add refresh_token, token_expires_at, refresh_token_expires_at columns to shops table (safe — checks hasColumn before adding)
  • Trait RefreshesShopifyToken: ensureValidAccessToken() checks expiry, refreshes automatically with cache lock to prevent race conditions on concurrent jobs, resets apiHelper so next api() call uses fresh token; overrides api() so protection is transparent to all callers

Shopify deprecated non-expiring offline tokens in December 2025. This fix is backward compatible: shops with NULL token_expires_at (installed before this change) are treated as legacy and will continue working until Shopify rejects their old token, at which point they re-open the app and get fresh expiring tokens via OAuth.

Haseeb9229 added 4 commits April 23, 2026 19:27
- composer.json: add Laravel ^13.0 to framework version constraint
- ApiHelper: override getAccessData() to POST with expiring=1 so Shopify
  returns short-lived access_token (1hr) + refresh_token (90 days)
- ApiHelper: add refreshAccessToken() method to exchange refresh token
- ApiHelper contract: add refreshAccessToken() to IApiHelper interface
- InstallShop: persist refresh_token, token_expires_at and
  refresh_token_expires_at after OAuth completes
- Migration: add refresh_token, token_expires_at, refresh_token_expires_at
  columns to shops table (safe — checks hasColumn before adding)
- Trait RefreshesShopifyToken: ensureValidAccessToken() checks expiry,
  refreshes automatically with cache lock to prevent race conditions on
  concurrent jobs, resets apiHelper so next api() call uses fresh token;
  overrides api() so protection is transparent to all callers

Shopify deprecated non-expiring offline tokens in December 2025.
This fix is backward compatible: shops with NULL token_expires_at
(installed before this change) are treated as legacy and will continue
working until Shopify rejects their old token, at which point they
re-open the app and get fresh expiring tokens via OAuth.
…e to prevent incomplete object unserialize error
@simone-boa-ideas

Copy link
Copy Markdown

Hi, there is a separate PR for adding support to Laravel 13 - which is still in a pending state.
I'm wondering if it makes sense to cover it as part of this PR too.
Won't it complicate life for the reviewing team, since you have a PR that introduces more than one feature?

@JonPurvis

Copy link
Copy Markdown
Collaborator

Yeah these 2 things are in separate PR's and although this PR updates composer.json to allow Laravel 13, it doesn't update the github workflow file. There are 2 releases planned:

@Haseeb9229 Haseeb9229 closed this Apr 27, 2026
@Haseeb9229
Haseeb9229 deleted the feature/laravel-13-expiring-tokens branch April 27, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants