We are starting to now integrate with Shopify using Node/Express, and i’m having issues with the cookie not being there after authentication to verify it.
Context:
Shopify.Context.initialize({
API_KEY: ‘xxxxxxxxxx’,
API_SECRET_KEY: ‘xxxxxxxxxxx’,
SCOPES: [‘write_products’],
HOST_NAME: ‘xxxxxx.ngrok.io’,
IS_EMBEDDED_APP: true,
API_VERSION: ApiVersion.October21,
});
redirect url works and auth is completed:
const shopifyUrl = await Shopify.Auth.beginAuth(req, res, ‘xxxxxxx.myshopify.com’, ‘/api/integration/shopify/auth’, true);
console.log(‘hit getShopifyAuthUrl’, req.cookies);
This console.log shows the following:
hit getShopifyAuthUrl {
shopify_app_session: ‘xxxxxxxxxxx’,
‘shopify_app_session.sig’: ‘xxxxxxxxxxx’,
}
Then in the validate part,
console.log(‘hit validateShopifyToken’, req.cookies);
const session = await Shopify.Auth.validateAuthCallback(req, res, req.query);
This log is an empty object which i think is my issue.
hit validateShopifyToken [Object: null prototype] {}
I have followed the video on: https://shopify.dev/apps/auth/oauth/getting-started and i’m out of ideas on what the issue is.
I have moved the Shopify.Context all over the place to avoid it possibly resetting on each network call, to no avail.
Any ideas?