betodealmeida commented on a change in pull request #14675:
URL: https://github.com/apache/superset/pull/14675#discussion_r633907629
##########
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:
@nytai looking at the docs we can't redirect a JSON request there
because it requires a `POST` payload with credentials.
I changed the method so that for API calls we show the SIP-40 error payload,
and for non-API calls we redirect the user to `/login`.
--
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]