nytai commented on a change in pull request #14675:
URL: https://github.com/apache/superset/pull/14675#discussion_r633911244



##########
File path: superset/views/base.py
##########
@@ -361,6 +371,13 @@ def show_superset_errors(ex: SupersetErrorsException) -> 
FlaskResponse:
     return json_errors_response(errors=ex.errors, status=ex.status)
 
 
+# Redirect to login if the CSRF token is expired
+@superset_app.errorhandler(CSRFError)
+def refresh_csrf_token(ex: CSRFError) -> FlaskResponse:
+    logger.warning(ex)
+    return redirect(appbuilder.get_url_for_login)

Review comment:
       yea that makes sense, how about instead of checking the path we check 
`request.is_json`? 
https://tedboy.github.io/flask/generated/generated/flask.Request.is_json.html#flask-request-is-json




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to