How to customize the logout behavior? I need to redirect to a specified URL when logging out. #33812
Replies: 1 comment
-
Superset's logout behavior is managed by Flask AppBuilder (FAB), not by a custom method in Superset itself. To redirect users to a specific URL after logout, you typically need to customize the Flask AppBuilder security manager. There isn't a built-in LOGOUT_REDIRECT_URL setting in Superset, but you can achieve this by subclassing the security manager and overriding the logout view to use Flask's redirect function. Here's a general approach:
Example: from flask import redirect
from superset.security import SupersetSecurityManager
from flask_appbuilder.security.views import AuthDBView
from flask_appbuilder.security.views import expose
class CustomAuthDBView(AuthDBView):
@expose('/logout/')
def logout(self):
response = super().logout()
return redirect("https://your-redirect-url.com")
class CustomSecurityManager(SupersetSecurityManager):
authdbview = CustomAuthDBView
CUSTOM_SECURITY_MANAGER = CustomSecurityManager Add this to your superset_config.py. This will override the default logout behavior and redirect users to your specified URL after logout. For more details on customizing authentication and redirection, see the discussion here. Let me know if you need a more specific example for your authentication backend. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I wanto code logout method in superset, but I didn't found the solve method.
Beta Was this translation helpful? Give feedback.
All reactions