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.
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025