-
Notifications
You must be signed in to change notification settings - Fork 172
Open
Description
In this line,
fastapi-jwt-auth/fastapi_jwt_auth/auth_jwt.py
Line 549 in a6c0619
csrf_token = request.headers.get(self._access_csrf_header_name) |
the code is trying to get
CSRF_TOKEN
from the headers and treating response.headers
as a dict
object which is true. But the headers don't contain the default "X-CSRF-Token"
. It contains the key-value pair with cookies
as key and all cookie info as a string separated by ;
.
So whenever someone tries to get CSRF token the code is unable to find the key "X-CSRF-Token"
in the headers but now it's inside key cookies
, which needs to be parsed for extracting CSRF_TOKEN
.
That's why whenever someone uses csrf_protect
as True
, they get a Missing CSRF Token
error every time
I can see the code is not updated for the last 2 years. That might be the reason that it is not in compliance with the browser's headers.
Metadata
Metadata
Assignees
Labels
No labels