Search code examples
phpcodeignitercookiesheadershopify

Header set cookie not working in shopify extension


I'm working on shopify extension on php codeigniter. 7.1 php version. I'm receiving this error while i'm installing extension on shopify. The app couldn’t be loaded Then i add this code in the default controller:

header('Set-Cookie: same-site-cookie=foo; SameSite=Lax');
header('Set-Cookie: cross-site-cookie=bar; SameSite=None; Secure');

But still i'm receiving above error. Even the cookie was created as i check it on Application > Storage > Cookies. Can anyone guide me that what is missing or why i'm still getting this error on chrome 80. Thanks! Find the attachments. https://ibb.co/fFpSsZj https://ibb.co/LdT6Zdq


Solution

  • Its working fine now. The solution is to go to chrome://flags and search for samesite and try to disable SameSite by default cookies and Cookies without SameSite must be secure options. Go to your app again, the error will hide. then go to Application > Storage > Cookies and check the app cookie which was created already. It may be include session id in the cookie. just replace this cookie including this SameSite=none, secure with same name,values etc and then again revert your flags settings and reload the app. It will work fine. Thanks!