Repository navigation
Subdomain CSRF
#1155
Replies: 3 comments 4 replies
|
Hi - quick question - I am not familiar with your cookie domain syntax - shouldn't it just be: "domain": "domain.com" Also - I assume that your browser is getting and setting the cookie - it's just that it isn't sending it on POST requests? |
2 replies
|
If your browser isn't actually accepting the cookie - then that's the first problem! So - from a browser debug window can you post the entire cookie contents? and maybe the actual request/response headers? |
0 replies
|
The issue is config["SECURITY_CSRF_COOKIE"] = {
"samesite": "Lax", # or "None" with secure=True
"httponly": False,
"secure": False, # True if using samesite=None
"domain": "domain.com"
}
|
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
We're using Flask Security in our application and we're having some trouble with the CSRF token when requests are coming from a different subdomain.
The setup is:
The problem is that the CSRF cookie isn't set on the frontend and subsequently not passed to the backend in further requests (thus failing the CSRF check).
I've read through the documentation but couldn't find any explanation for this use case. There appear to be a lot of configuration values around this but I'm struggling to find the correct combination to get this working.
The current CSRF settings are:
Any help would be greatly appreciated.
All reactions