GitHub user dosubot[bot] added a comment to the discussion: Redirect upon logging in
<!-- Answer --> Your previous approach no longer works because Superset v6 migrated to a React frontend that decoupled UI routing from Flask/FAB backend logic. The `FAB_INDEX_VIEW` configuration and custom `IndexView` classes are now [ignored by the React frontend](https://github.com/apache/superset/discussions/36925). **Recommended Solution:** Use a custom security manager to implement role-based redirects: ```python # In your superset_config.py from flask_appbuilder.security.views import AuthView from flask import redirect, g from superset.security import SupersetSecurityManager class CustomAuthView(AuthView): @expose("/") def index(self): if g.user and g.user.is_authenticated: # Custom role-based redirect logic if 'Admin' in [role.name for role in g.user.roles]: return redirect('/superset/dashboard/list/') elif 'Alpha' in [role.name for role in g.user.roles]: return redirect('/chart/list/') else: return redirect('/superset/welcome/') return super().index() class CustomSecurityManager(SupersetSecurityManager): authview = CustomAuthView CUSTOM_SECURITY_MANAGER = CustomSecurityManager ``` This approach is [confirmed to work in v6](https://github.com/apache/superset/discussions/37057#discussioncomment-15474121). You can adapt the role checks and redirect URLs to match your requirements. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=brand-link).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/62b611ca-2fc2-4fb5-9282-c88edcc2a0b2?feedback_type=great_response&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/62b611ca-2fc2-4fb5-9282-c88edcc2a0b2?feedback_type=irrelevant_answer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/62b611ca-2fc2-4fb5-9282-c88edcc2a0b2?feedback_type=incorrect_sources&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/62b611ca-2fc2-4fb5-9282-c88edcc2a0b2?feedback_type=too_verbose&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/62b611ca-2fc2-4f b5-9282-c88edcc2a0b2?feedback_type=hallucination&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/62b611ca-2fc2-4fb5-9282-c88edcc2a0b2?feedback_type=bug_report&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-bug_report) | [Other](https://app.dosu.dev/response-feedback/62b611ca-2fc2-4fb5-9282-c88edcc2a0b2?feedback_type=other&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=chat-badge) [](https://cursor.com/link/prompt?text=Your%20previous%20approach%20no%20longer%20works%20because%20Superset%20v6%20migrated%20to%20a%20React%20frontend%20that%20decoupled%20UI%20routing%20from%20Flask/FAB%20backend%20logic.%20The%20%60FAB_INDEX_VIEW%60%20configuration%20and%20custom%20%60IndexView%60%20classes%20are%20now%20%5Bignored%20by%20the%20React%20frontend%5D%28https%3A//github.com/apache/superset/discussions/36925%29.%0A%0A%2A%2ARecommended%20Solution%3A%2A%2A%20Use%20a%20custom%20security%20manager%20to%20implement%20role-based%20redirects%3A%0A%0A%60%60%60python%0A%23%20In%20your%20superset_config.py%0Afrom%20flask_appbuilder.security.views%20import%20AuthView%0Afrom%20flask%20import%20redirect%2C%20g%0 Afrom%20superset.security%20import%20SupersetSecurityManager%0A%0Aclass%20CustomAuthView%28AuthView%29%3A%0A%20%20%20%20%40expose%28%22/%22%29%0A%20%20%20%20def%20index%28self%29%3A%0A%20%20%20%20%20%20%20%20if%20g.user%20and%20g.user.is_authenticated%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%23%20Custom%20role-based%20redirect%20logic%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20%27Admin%27%20in%20%5Brole.name%20for%20role%20in%20g.user.roles%5D%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20return%20redirect%28%27/superset/dashboard/list/%27%29%0A%20%20%20%20%20%20%20%20%20%20%20%20elif%20%27Alpha%27%20in%20%5Brole.name%20for%20role%20in%20g.user.roles%5D%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20return%20redirect%28%27/chart/list/%27%29%0A%20%20%20%20%20%20%20%20%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20return%20redirect%28%27/superset/welcome/%27%29%0A%20%20%20%20%20%20%20%20return%20super%28%29.index%28%29%0A%0Aclass%20CustomSecurityMa nager%28SupersetSecurityManager%29%3A%0A%20%20%20%20authview%20%3D%20CustomAuthView%0A%0ACUSTOM_SECURITY_MANAGER%20%3D%20CustomSecurityManager%0A%60%60%60%0A%0AThis%20approach%20is%20%5Bconfirmed%20to%20work%20in%20v6%5D%28https%3A//github.com/apache/superset/discussions/37057%23discussioncomment-15474121%29.%20You%20can%20adapt%20the%20role%20checks%20and%20redirect%20URLs%20to%20match%20your%20requirements.) [](https://go.dosu.dev/discord-bot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=join-discord) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/38580) GitHub link: https://github.com/apache/superset/discussions/38580#discussioncomment-16083358 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
