Decoding CSRF Token from cookies does not work
Hello!
I noticed that set_access_cookies method has support for csrf_in_cookies and set the CSRF token in a cookie together with JWT access token.
While using a protected route with @jwt_required(), I notice that _decode_jwt_from_cookies method does not have the functionality to handle the csrf_token from cookie. It only knows how to handle it from Header.
I replaced the line csrf_value = request.headers.get(csrf_header_key, None) with csrf_value = request.cookies.get("csrf_access_token") it works. My question is: Is this intended to be like that or is a missing functionality ?
In case this is a missing functionality I could create a PR
That is 100% intentional. If you tried to verify the CSRF token from the cookie, you would be vulnerable to CSRF attacks.
The documentation goes into the details of all this here: https://flask-jwt-extended.readthedocs.io/en/stable/token_locations.html#cookies