Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Custom session storage using Node code from CLI 3.x

Custom session storage using Node code from CLI 3.x

dbleeker
Shopify Partner
9 0 5

I'm moving our app code into the app framework generated by Shopify CLI 3.x .  I can't find any documentation on how to implement custom session storage.  The way we we're doing it is:

 

const sessionStorage = new Shopify.Session.CustomSessionStorage(
  myStoreCallback,
  myLoadCallback,
  myDeleteCallback
);
 
I know that there are two new handlers required (deleteSessions, findSessionsByShop)  but cannot find how to create the SessionStorage object as Shopify.Session.CustomSessionStorage constructor no longer exists.

If there is any documentation available please provide a link; failing that please tell me how to create the custom session storage object.

Many thanks!
Replies 4 (4)

originmaster
Shopify Partner
45 2 20

I have the same issue. It's really tough having to keep up with changes to the api without sufficient documentation.

morbo
Shopify Partner
4 0 0

Turns out there’s a tab under partner interface called “Team”

You could give another dev permission to the app you are building. 

originmaster
Shopify Partner
45 2 20

That's not answering the actual problem.

originmaster
Shopify Partner
45 2 20

@dbleeker Here's what I did. Created a CustomSessionStorage class:

export class CustomSessionStorage {
  async storeSession(session) {...}

  async loadSession(id) {...}

  async deleteSession(id) {...}

  async deleteSessions(ids) {...}

  async findSessionsByShop(shop) {...}
}

 

Create an instance in your shopify config:

sessionStorage: new CustomSessionStorage()

 

All return values for the class methods are described here: https://github.com/Shopify/shopify-app-js/blob/main/packages/shopify-app-session-storage/implementin...

Good luck 🙂