Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi
I'm using v6 of shopify-app-js. I've created both online and offline tokens and stored them in my db.
I'm trying to create an offline session token for use with the graphql client as I'm accessing an endpoint from outside the app (posting data from the storefront to the app), but I can't see how to get the offline session token from my db?
This >> https://github.com/Shopify/shopify-api-js/blob/main/docs/guides/session-storage.md says to use
const sessionId = await shopify.session.getCurrentId({
isOnline: true,
rawRequest: req,
rawResponse: res,
});
// use sessionId to retrieve session from app's session storage
// getSessionFromStorage() must be provided by application
const session = await getSessionFromStorage(sessionId);
const restClient = new shopify.clients.Rest({session});
I don't understand this part
const session = await getSessionFromStorage(sessionId);
I can't see or find how to use / access getSessionFromStorage. I've tried pulling it in myself from the db (didn't work), but I believe you have to generate the session object somehow, and I'm unsure how?
Hi, have you found it?
This is the problem with shopify docs, its soooo INCOMPLETE. you have to figure it our on your own.
Also shopify.session.getCurrentId wont work in the latest node boilerplate it should be shopify.api.session.getCurrentId
Hi,
Yes but what i did is to use the accessToken from database stored automatically in mongodb session storage.. I think you can create session using the data stored automatically with session storage.
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024