Socket
Socket
Sign inDemoInstall

@ansugroup/isolate-shopify-api

Package Overview
Dependencies
44
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @ansugroup/isolate-shopify-api

Isolate Shopfy API - Wrap Shopify API and make it isolate


Version published
Maintainers
1
Install size
3.62 MB
Created

Readme

Source

@ansugroup/isolate-shopify-api

Nodejs

By default, @shopify/shopify-api will use one variable: Shopify for APIs calling.

This package: @ansugroup/isolate-shopify-api will help if you want to connect to APIs on behalf of multiple apps/stores.

Install

yarn add @ansugroup/isolate-shopify-api

Usage

Split Shopify API by app

import Shopify, { ApiVersion } from "@shopify/shopify-api";
import createIsolateShopify from "@ansugroup/isolate-shopify-api";

const shopifyApp1 = createIsolateShopify({
  // default config from Shopify example:
  API_KEY: process.env.SHOPIFY_API_KEY_APP_1,
  API_SECRET_KEY: process.env.SHOPIFY_API_SECRET_APP_1,
  SCOPES: process.env.SCOPES.split(","),
  HOST_NAME: process.env.HOST.replace(/https:\/\//, ""),
  API_VERSION: ApiVersion.October20,
  IS_EMBEDDED_APP: true,
  // This should be replaced with your preferred storage strategy
  SESSION_STORAGE: new Shopify.Session.MemorySessionStorage(),
});

// shopifyApp1.Clients.Rest ...

const shopifyApp2 = createIsolateShopify({
  API_KEY: process.env.SHOPIFY_API_KEY_APP_2,
  API_SECRET_KEY: process.env.SHOPIFY_API_SECRET_APP_2,
  SCOPES: process.env.SCOPES.split(","),
  HOST_NAME: process.env.HOST.replace(/https:\/\//, ""),
  API_VERSION: ApiVersion.October20,
  IS_EMBEDDED_APP: true,
  // This should be replaced with your preferred storage strategy
  SESSION_STORAGE: new Shopify.Session.MemorySessionStorage(),
});

// shopifyApp2.Clients.Rest ...
// not get the value or overwrite the value of shopifyApp1

License

MIT

Keywords

FAQs

Last updated on 22 Nov 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc