INNER CODE UNIT · Python
set_access_cookies
IndominusByte/fastapi-jwt-auth · fastapi_jwt_auth/auth_jwt.py:316
def set_access_cookies(
self,
encoded_access_token: str,
response: Optional[Response] = None,
max_age: Optional[int] = None
) -> None:
"""
Configures the response to set access token in a cookie.
this will also set the CSRF double submit values in a separate cookie
:param encoded_access_token: The encoded access token to set in the cookies
:param response: The FastAPI response object to set the access cookies in
:param max_age: The max age of the cookie value should be the number of seconds (integer)
"""
if not self.jwt_in_cookies:
raise RuntimeWarning(
"set_access_cookies() called without 'authjwt_token_location' configured to use cookies"
)