I currently have a custom sessionStorage handler which is storing sessions from a single app (node/express created from shopify cli) via database (Supabase, fwiw).
I want to be able to expand this database to handle session data from multiple apps, many of which might concurrently exist on the same domain. Ideally, I’d store the app id in the session itself, but the issue is I don’t seem to be able to find a way to find that id (or some other permanent and distinct app identifier) until the session already exists and I can query it via the apps graphql query.
So my question is, is there a way to find a unique identifier for the currently running app, from its own environment, without external queries, or is there a way to ask this of the Shopify API without the session being active? Or even to have the CLI write this ID to env when it’s creating the app?
Obviously I could manually hardcode this ID as soon as the CLI generates it, but I’m hoping for something more dynamic, so that I can more easily spin up test apps. I thought about pulling SHOPIFY_API_KEY from process.env and using this as a unique identifier, but it will break relations if/when I ever have to reset that key, so that’s not ideal. Any other options or more obvious other ways I should approach this?