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
- Create a SlashID account
- Follow the integration guide on the SlashID developer portal
- Make sure you have the following information:
storeURL
- the URL of your Shopify storeexternalCredentialsId
- the ID of the external credentials you created in the SlashID developer portalslashIdToken
- 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 });
let customerAccessToken = await shopifySDK.getCustomerAccessToken(
slashIdToken,
externalCredentialsId
);
let multipassToken = await shopifySDK.getMultipassToken(
slashIdToken,
externalCredentialsId
);
shopifySDK.redirectToShopify(multipassToken);
let multipassTokenWithReturnTo = await shopifySDK.getMultipassToken(
slashIdToken,
externalCredentialsId,
multipassFields: {
return_to: "https://mystore.myshopify.com/cart",
}
);
shopifySDK.redirectToShopify(multipassToken);