Shopify App Session Storage for Firestore
import {initializeApp, cert} from 'firebase-admin/app'
import {getFirestore} from 'firebase-admin/firestore'
import {shopifyApp} from '@shopify/shopify-app-express';
import {FirestoreSessionStorage} from '@tkashiro/shopify-app-session-storage-firestore';
const firebaseApp = initializeApp({
credential: cert('/path/to/service-account.json'),
})
const firestore = getFirestore(firebaseApp)
const shopify = shopifyApp({
sessionStorage: new FirestoreSessionStorage({
firestore: firestore,
collectionName: 'shopify_sessions' // optional
}),
// ...
});
Firestore now support TTL (Time-to-live) policy which enable you to delete expired session. Check official document for more detail.