koa-shopify-auth icon indicating copy to clipboard operation
koa-shopify-auth copied to clipboard

Issues with pages routes with new shopify session system

Open aurelienbobenrieth opened this issue 3 years ago • 2 comments

I've been trying to rework an app to use the new session auth system. Everything seems to work fine, however I am not able to use the Navigation (polaris) component successfully.

Let's say I have something like this :

<Navigation.Section
    items={[
        {
            url : '/faq',
            label : translations.faq,
            icon : HintMajor
        }
    ]}
/>

If I only put /faq I am unable to access the route. I am redirected to /auth and get obviously an error.

The only way I manage to make my routes work is to :

  1. Add the shop query in each url like this :
// ...
url : '/faq?shop=${shop}',
// ...
  1. Add every needed routes manually in my server.js WITHOUT the verifyRequest middleware (which does not seem like a good option to me)
// ...
router.get('/faq', handleRequest)
// ...

Can someone explain if I am doing anything wrong ? (I am managing my SESSION_STORAGE with the custom redis storage shown in the repo doc https://github.com/Shopify/shopify-node-api/blob/main/docs/usage/customsessions.md)

aurelienbobenrieth avatar May 28 '21 08:05 aurelienbobenrieth

And I am unable to navigate through my pages without the whole page reloading.

For example, if I use :

import { useRouter } from 'next/router'
// ...
const router = useRouter()

const updateRoute = (route) => {
    router.push(route)
}
// ...
updateRoute('/faq?shop=${shop}')

The whole page will reload.

I am not getting it.

aurelienbobenrieth avatar Jun 03 '21 11:06 aurelienbobenrieth

+1 on this error I have this problem as well, was wondering if there's any workarounds for this?

musubipapi avatar Jul 10 '21 03:07 musubipapi

Note that this repo is no longer maintained and this issue will not be reviewed. Prefer the official JavaScript API library. If you still want to use Koa, see simple-koa-shopify-auth for a potential community solution.

github-actions[bot] avatar Jan 30 '23 20:01 github-actions[bot]