@@ -388,6 +388,10 @@ def set_access_cookies(response, encoded_access_token):
388
388
Takes a flask response object, and configures it to set the encoded access
389
389
token in a cookie (as well as a csrf access cookie if enabled)
390
390
"""
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
+
391
395
# Set the access JWT in the cookie
392
396
response .set_cookie (get_access_cookie_name (),
393
397
value = encoded_access_token ,
@@ -409,6 +413,10 @@ def set_refresh_cookies(response, encoded_refresh_token):
409
413
Takes a flask response object, and configures it to set the encoded refresh
410
414
token in a cookie (as well as a csrf refresh cookie if enabled)
411
415
"""
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
+
412
420
# Set the refresh JWT in the cookie
413
421
response .set_cookie (get_refresh_cookie_name (),
414
422
value = encoded_refresh_token ,
@@ -431,6 +439,10 @@ def unset_jwt_cookies(response):
431
439
cookies. Basically, this is a logout helper method if using cookies to store
432
440
the JWT
433
441
"""
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
+
434
446
response .set_cookie (get_refresh_cookie_name (),
435
447
value = '' ,
436
448
expires = 0 ,
0 commit comments