You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Experiment and document how to use cookies vs headers for JWT tokens #33
Note that in the cookie example the CSRF protection is turned off
classJWTAuthConfig(BaseModel):
"""A model required by the JWT auth plugin The FastAPI initialiser registers a decorated instance. """authjwt_token_location: set= {"cookies"}
authjwt_secret_key:str=config.JWT_SECRET.get_secret_value()
authjwt_access_token_expires=Falseauthjwt_cookie_csrf_protect: bool=False
Activity
devraj commentedon Aug 11, 2022
Switching to cookies involves these steps note the use of
to set the cookies and
to unset (logout) the cookie
devraj commentedon Sep 21, 2022
This particular portion has to do with the client side code, the OTC api clients can be configured to send headers in the following way.
Moving away from using
cookieswill allow us to restore CSRF protection in a uniform way (both things being handled by headers)there is merit to documenting both approaches and we should weigh up pros and cons for both.