@@ -388,6 +388,10 @@ def set_access_cookies(response, encoded_access_token):
388388 Takes a flask response object, and configures it to set the encoded access
389389 token in a cookie (as well as a csrf access cookie if enabled)
390390 """
391+ if 'cookies' not in get_token_location ():
392+ raise RuntimeWarning ("set_access_cookies() called without "
393+ "'JWT_TOKEN_LOCATION' configured to use cookies" )
394+
391395 # Set the access JWT in the cookie
392396 response .set_cookie (get_access_cookie_name (),
393397 value = encoded_access_token ,
@@ -409,6 +413,10 @@ def set_refresh_cookies(response, encoded_refresh_token):
409413 Takes a flask response object, and configures it to set the encoded refresh
410414 token in a cookie (as well as a csrf refresh cookie if enabled)
411415 """
416+ if 'cookies' not in get_token_location ():
417+ raise RuntimeWarning ("set_refresh_cookies() called without "
418+ "'JWT_TOKEN_LOCATION' configured to use cookies" )
419+
412420 # Set the refresh JWT in the cookie
413421 response .set_cookie (get_refresh_cookie_name (),
414422 value = encoded_refresh_token ,
@@ -431,6 +439,10 @@ def unset_jwt_cookies(response):
431439 cookies. Basically, this is a logout helper method if using cookies to store
432440 the JWT
433441 """
442+ if 'cookies' not in get_token_location ():
443+ raise RuntimeWarning ("unset_refresh_cookies() called without "
444+ "'JWT_TOKEN_LOCATION' configured to use cookies" )
445+
434446 response .set_cookie (get_refresh_cookie_name (),
435447 value = '' ,
436448 expires = 0 ,
0 commit comments