Configure mutliple login types #35647
Replies: 1 comment
-
Superset does not natively support showing both OAuth and database login options on the same login page—only one authentication type can be active at a time via the Here’s a simplified example of how you might do this: from flask import redirect, request
from superset.security import SupersetSecurityManager
from flask_login import login_user
from flask_appbuilder.security.views import AuthDBView, expose
class CustomAuthDBView(AuthDBView):
@expose('/login/', methods=['GET', 'POST'])
def login(self):
token = request.args.get('token')
if token == 'SOME_TOKEN_VALUE':
user = self.appbuilder.sm.find_user(username=request.args.get('username'))
login_user(user)
return redirect(self.appbuilder.get_url_for_index)
else:
return super(CustomAuthDBView, self).login()
class CustomSecurityManager(SupersetSecurityManager):
authdbview = CustomAuthDBView
CUSTOM_SECURITY_MANAGER = CustomSecurityManager With this setup, users can log in either by visiting a URL with a token (for SSO) or by using the standard login form for database authentication. This requires custom development and is not officially documented or supported out-of-the-box (details). If you need both OAuth and database login options visible and functional on the same page, you’ll need to extend both backend and frontend logic to support this hybrid flow. Be aware that this approach may require ongoing maintenance as Superset evolves. 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.
-
How do I configure multiple login types and pages on the same page? I want to enable OAUTH login and database login. The users will have an option to login with one of the way.
Beta Was this translation helpful? Give feedback.
All reactions