ctx.cookies.set('shopOrigin') doesn't work

Highlighted
New Member
1 0 0

Hello Guys,

I have followed this latest tutorial from shopify - https://shopify.dev/tutorials/build-a-shopify-app-with-node-and-react

On my server.js I have this code:

 

      afterAuth(ctx) {
        const { shop, accessToken } = ctx.session;
        ctx.cookies.set('shopOrigin', shop, {
          httpOnly: false,
          secure: true,
          sameSite: 'none'
        });
    }

 

 

On my _app.js I have this code:

 

const config = { apiKey: API_KEY, shopOrigin: Cookies.get("shopOrigin"), forceRedirect: true };

 

 

During installation I tried to console log the config

 

  const config = { apiKey: API_KEY, shopOrigin: Cookies.get("shopOrigin"), forceRedirect: true };
  console.log(config);

 

 

I got this response:

 

{
apiKey: '4967243417b61ca632f8111072003815',
shopOrigin: undefined,
forceRedirect: true
}

 

 

Looks like the ctx.cookies.set('shopOrigin') functionality doesn't work anymore.

Is anyone experience the same issue or do shopify has new way to do it now?

Thank you in advance.

 

Kind regards,
Cedric

0 Likes