Releases: Shopify/shopify-app-js
Releases · Shopify/shopify-app-js
@shopify/shopify-app-session-storage@4.0.4
@shopify/shopify-app-session-storage@4.0.4
@shopify/shopify-app-session-storage-sqlite@5.0.4
@shopify/shopify-app-session-storage-sqlite@5.0.4
@shopify/shopify-app-session-storage-redis@5.0.4
@shopify/shopify-app-session-storage-redis@5.0.4
@shopify/shopify-app-session-storage-prisma@8.0.0
Major Changes
-
700377f: ## Store user information as part of the session
With this change, OAuth refresh tokens and their expiration dates are now stored as part of the session. Previously, only access tokens were persisted. This enables automatic token refresh for long-lived sessions, reducing the need for users to re-authenticate when access tokens expire. This is a backward-compatible change, as the new Prisma schema fields are optional and existing sessions will continue to work without modification.
The session object now includes the following additional fields:
{ id: 'offline_session_id', shop: 'my-shop.myshopify.com', state: 'session-state', isOnline: false, scope: 'read_products,write_orders', accessToken: 'shpat_abc123', expires: 2025-11-17T18:00:00.000Z, refreshToken: 'shprt_def456', // New field refreshTokenExpires: 2025-12-17T18:00:00.000Z, // New field }
You will be able to access the refresh token information on the Session object once you migrate your schema.
To migrate your schema:
- Add the new fields to your
Sessionmodel in the Prisma Schema:
model Session { // ... refreshToken String? refreshTokenExpires DateTime? }
- Run the migration command:
npx prisma migrate dev
- Update the generated types to include the new fields:
npx prisma generate
Usage:
const session = await sessionStorage.loadSession(sessionId); console.log('refresh token', session.refreshToken); console.log('refresh token expires', session.refreshTokenExpires); // Check if refreshToken is available if (session.refreshToken) { // Use refresh token to get a new access token }
- Add the new fields to your
@shopify/shopify-app-session-storage-postgresql@5.0.4
@shopify/shopify-app-session-storage-postgresql@5.0.4
@shopify/shopify-app-session-storage-mysql@5.0.4
Patch Changes
- f5a3027: Updated
mysql2dependencies
@shopify/shopify-app-session-storage-mongodb@5.0.4
@shopify/shopify-app-session-storage-mongodb@5.0.4
@shopify/shopify-app-session-storage-memory@5.0.4
@shopify/shopify-app-session-storage-memory@5.0.4
@shopify/shopify-app-session-storage-kv@5.0.4
@shopify/shopify-app-session-storage-kv@5.0.4
@shopify/shopify-app-session-storage-dynamodb@5.0.6
@shopify/shopify-app-session-storage-dynamodb@5.0.6