Shopify / koa-shopify-auth

DEPRECATED Middleware to authenticate a Koa application with Shopify
MIT License
80 stars 63 forks source link

Issues with pages routes with new shopify session system #104

Closed aurelienbobenrieth closed 1 year ago

aurelienbobenrieth commented 3 years ago

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}',
    // ...
  2. 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 commented 3 years ago

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.

musubipapi commented 3 years ago

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

github-actions[bot] commented 1 year ago

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.