如何使用SQLite设置和访问Shopify的会话

vptzau2j  于 2023-06-23  发布在  SQLite
关注(0)|答案(1)|浏览(153)

这是用sqlite sessionStorage设置商店的正确方法吗?

const storage = new SQLiteSessionStorage(DB_PATH)
const shopify = shopifyApp({
  api: {
    apiVersion: LATEST_API_VERSION,
    restResources,
    billing: undefined, // or replace with billingConfig above to enable example billing
    scopes: ['write_products', 'read_locales'],
  },
  auth: {
    path: '/api/auth',
    callbackPath: '/api/auth/callback',
  },
  webhooks: {
    path: '/api/webhooks',
  },
  sessionStorage: storage,

});
export default shopify;

如果是,我如何从我的应用程序的任何地方访问此会话?

33qvvth1

33qvvth11#

例如:

import shopify from "../shopify.js";
const sessionId = await shopify.api.session.getOfflineId('myshop.shopify.com');

相关问题