@slashid/shopify-sdk
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

SlashID Shopify SDK

Shopify SDK allows you to seamlessly authenticate your customers to Shopify with SlashID. This is done by exchanging a SlashID user token for a Shopify Multipass token.

Read the docs

Installation

npm install @slashid/shopify-sdk

Setup

  1. Create a SlashID account
  2. Follow the integration guide on the SlashID developer portal
  3. Make sure you have the following information:
    • storeURL - the URL of your Shopify store
    • externalCredentialsId - the ID of the external credentials you created in the SlashID developer portal
    • slashIdToken - the token you get by logging in with SlashID

Usage

import { ShopifySDK } from "@slashid/shopify-sdk";

const storeURL = "https://mystore.myshopify.com";
const slashIdToken = "<get the token by logging in with SlashID>";
const externalCredentialsId = "<store Shopify secrets safely with SlashID>";

let shopifySDK = new ShopifySDK({ storeURL });

// get a customer access token to use with the Shopify Storefront API
let customerAccessToken = await shopifySDK.getCustomerAccessToken(
  slashIdToken,
  externalCredentialsId
);

// navigate to the Shopify store without having to login again
let multipassToken = await shopifySDK.getMultipassToken(
  slashIdToken,
  externalCredentialsId
);
shopifySDK.redirectToShopify(multipassToken);

// optionally pass a return_to field to be used in Multipass
let multipassTokenWithReturnTo = await shopifySDK.getMultipassToken(
  slashIdToken,
  externalCredentialsId,
  multipassFields: {
    return_to: "https://mystore.myshopify.com/cart",
  }
);

// Shopify will redirect to the return_to URL after login
shopifySDK.redirectToShopify(multipassToken);

Readme

Keywords

none

Package Sidebar

Install

npm i @slashid/shopify-sdk

Weekly Downloads

0

Version

0.1.0

License

none

Unpacked Size

10.5 kB

Total Files

6

Last publish

Collaborators

  • jake-slashid
  • paulo_raca
  • kasper_mroz
  • jcmfernandes
  • pedrobrandao
  • josephmgardner
  • kobeljic
  • roblaszczak
  • snagg
  • balenio