question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't log in to admin on Chrome & Safari - possible CloudFlare cookie issue?

See original GitHub issue

I’ve got an issue where when I try to log in to the admin section on Chrome and Safari. The authentication call goes through and it redirects to admin from the login, but then I get a 401 from the auth, store and users routes and I get redirected back to the login page. This doesn’t happen on Firefox.

I don’t get any useful output from Medusa when the login attempt happens, just the return of the 401. In Chrome’s response headers for set-cookie, there’s a warning and it says

This Set-Cookie didn't specify a "SameSite" attribute and was default to "SameSite=Lax" and was blocked because it came from a cross-site response which was not the response to a top-level navigation. The Set-Cookie had to have been set with "SameSite=None" to enable cross-site usage.

My NODE_ENV=production so it should be being set to none, but that isn’t happening (both Secure and SameSite have no value). I can manually set Secure and SameSite and this then allows login, but it causes other issues from my storefront. Plus it’s not a very satisfying conclusion.

I’m running medusa at a subdomain through CloudFlare using a proxied A record, so this stackoverflow issue seems to be close to my problem, but the only solution there is already how things are set up here i.e. we’re using app.set("trust proxy", 1). The admin is on Netlify at a netlify.app domain.

Also I’m not sure if this should actually be a medusajs/medusa issue, rather than admin as it seems that my problem is with the cookie that’s being set there, but it’s presenting as an admin issue so I’m posting here for now.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:3
  • Comments:13 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
edihasajcommented, Nov 7, 2022

Api backend

1reaction
revskill10commented, Jul 16, 2022

So, basically this repository is unsuable within cloud environment ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Login issues related to browser cookies | Atlassian Support
Enable cookies in a web browser ; Safari. Open Safari, select Safari > Preferences from the top menu bar. Select Privacy. Clear the...
Read more >
Can't access wp-admin on website - Cloudflare Community
I can access the website but can't access the wp-admin . ... All cookies and caches have been cleared on both chrome and...
Read more >
How to Fix Cloudflare's Error 1020: Access Denied - MakeUseOf
It's the same information, known as a cookie, that enables services like Cloudflare to control your access to these websites. Therefore, your ...
Read more >
Error 1020 Access Denied: Find out How to Fix it Fast
As mentioned, Cloudflare uses cookies to control users' access to the website. Therefore, it is important to check in the browser's settings if ......
Read more >
Cache issue at login page after activating Cloudflare
These are the steps I took then: 1. Checked my Chrome settings and it is set on “Allow sites to save and read...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found