-
Notifications
You must be signed in to change notification settings - Fork 398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom Session Storage #1226
Comments
See the implementing session storage guide. Using the example in that guide, you would import your custom session storage (e.g.,
|
yeah i tried that but iam receiving an error on SessionStorage from @shopify/shopify-app-session-storage i tried import {SessionStorage} from '@shopify/shopify-app-session-storage'; and import SessionStorage from '@shopify/shopify-app-session-storage'; one gives undefined and another gives empty object {} can you help me in this ??? |
Have you added the What versions of |
yes i have installed that package iam working on latest app template which is on @shopify/shopify-app-express version 1.1.0 |
The correct import {SessionStorage} from '@shopify/shopify-app-session-storage'; What's the exact error you are receiving? |
yes its giving error of es6 like syntax error SessionStorage is not found at ..... CommonJs Module etc |
I don't understand what that last message is supposed to mean ...
|
I unfortunately run into the same problem at the new shopify cli3. import {Session} from '@shopify/shopify-api';
import {SessionStorage} from '@shopify/shopify-app-session-storage';
export class CustomSessionStorage extends SessionStorage {
...
} If the following error occurs.is there a way to create an analog javascript class with the import {CustomSessionStorage} from "./customSessionNewCli3.js";
const shopify = shopifyApp({
api: {
apiKey: process.env.SHOPIFY_API_KEY,
apiSecretKey: process.env.SHOPIFY_API_SECRET,
hostName: process.env.HOST.replace(/https?:\/\//, ''),
hostScheme: 'https',
apiVersion: LATEST_API_VERSION,
restResources,
billing: billingConfigSubscriptionPayment, // or replace with billingConfig above to enable example billing
scopes: process.env.SCOPES.split(","), //process.env.SCOPES.split(",")
isEmbeddedApp: true,
},
auth: {
path: "/api/auth",
callbackPath: "/api/auth/callback",
},
webhooks: {
path: "/api/webhooks",
},
useOnlineTokens: false, // declare offline session token
// This should be replaced with your preferred storage strategy
sessionStorage: new CustomSessionStorage,
}); I hope you understand what I mean. |
I was also struggling with how to implement CustomSessionStorage. I adapted the guide that @mkevinosullivan linked to. If you're not using typescript you don't need to use the
The shopify guide linked to above gives all the return values needed for the class methods. Create an instance when you initialise your shopify config like:
|
@meandillar Thanks for your reply - yes, the guide is in TypeScript and needs to be converted to JavaScript for JS-based applications. |
orrr - @mkevinosullivan - provide a template in Typescript:) (I know - its' a big task - meanwhile - if one could solve the code navigation when one installs the package and be able to see the source code easily and navigate on it - that would be a great help) one thing that bugs me - if the shopify store domain is already on the JWT token - why do we need to store sessions at all?:) can't we just validate the token and use that? that would be sooo much better and leaner - and everything:) |
it would be great if this file has a link or a table with the fields of a session - link to the type definition would suffice |
that means that we cant use import {SessionStorage} from '@shopify/shopify-app-session-storage'; in JS based projects because its in type script thats bad because when we implement custom session like this export class CustomSessionStorage { async loadSession(id) {...} async deleteSession(id) {...} async deleteSessions(ids) {...} async findSessionsByShop(shop) {...} it does not have isActive function there espacially its required in the new shopify app remix template |
@pkyek1 if you create a custom implementation there is nothing stopping you from adding an "isActive" function, or any other function for that matter |
As Now The Shopify App Template Updated, I want to know how can i create custom session storage
its very clear that i cannot do it like old ways because now its not getting Shopify.Session.CustomSessionStorage
so i cannot use the below code
sessionStorage: new Shopify.Session.CustomSessionStorage(
storeCallback,
loadCallback,
deleteCallback
),
can anyone help me in this ???
The text was updated successfully, but these errors were encountered: