I need to save a cookie that will last for 3 weeks on my Shopify server to allow users to access a third party API without providing their login credentials each session load. With the Shopify express backend framework, how do I dynamically set a cookie and then retrieve it in future sessions?
A general example of what I understood to be the correct cookie setting/retrieving process for Shopify:
app.get('/setCookie', async (req, res) => {
res.cookie('test-cookie', 'test-cookie-data', {
signed: true,
httpOnly: true,
sameSite: 'strict',
maxAge: 99999999999 // placeholder
});
});
app.get('/getCookie', async (req, res) => {
console.log(req.signedCookies['test-cookie']);
});
However, whenever I try to access req.signedCookies or req.cookies, I am returned a null object, even after calling the setCookies route. What am I missing?
Thanks!