How to enable SSO login in Superset using Keycloak access token? #36203
-
|
Hi everyone, I need some help with Superset + Keycloak SSO integration. I’m working on a backend where I’m generating Keycloak access tokens for Superset after the user logs in through Keycloak from my frontend. When user login with frontend superset access token generated with keycloak. in frontend dashboard have one button for redirect superset. but when user clicks superset button it redirect to superset login page and asking login credentilas. I have a few questions and would appreciate any guidance: Is it possible for Superset to log in directly using a Keycloak access token? If not, what is the correct way to implement SSO between Superset and Keycloak, so that users don’t have to log in again? Any suggestions, best practices, or examples would be really helpful. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Hi @goliudaykumar! I'm Dosu and I’m helping the superset team. Superset does not natively support logging in directly with a Keycloak access token (JWT) passed from your frontend. Instead, the recommended approach is to configure Superset as an OAuth2/OpenID Connect (OIDC) client with Keycloak. This way, when users access Superset, they are redirected to Keycloak for authentication, and Superset receives the necessary tokens to create a user session—no double login required if the user already has a Keycloak session. For Keycloak, you can use either the Authlib-based OAuth2 integration or, if you run into compatibility issues, the Flask-OIDC integration. Both approaches require configuring Superset to use Keycloak as the authentication provider and setting up a custom security manager if you need advanced behavior or user info mapping. You can find a detailed example of the Flask-OIDC approach (including a custom security manager and required config files) in the official Superset documentation and this pull request. This setup allows Superset to validate the Keycloak-issued tokens and create user sessions automatically during the OAuth2/OIDC flow, but not from a token passed directly from your frontend. If you want to implement a custom flow where a token in the URL logs the user in, you would need to write a custom security manager and login view, as shown in this discussion, but this is not standard and requires extra care for security. Best practice is to use the standard OAuth2/OIDC redirect flow for SSO. Make sure your Superset instance is configured to use Keycloak as an OIDC provider, and users will get seamless SSO as long as they are already authenticated with Keycloak. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
Hi @goliudaykumar! I'm Dosu and I’m helping the superset team.
Superset does not natively support logging in directly with a Keycloak access token (JWT) passed from your frontend. Instead, the recommended approach is to configure Superset as an OAuth2/OpenID Connect (OIDC) client with Keycloak. This way, when users access Superset, they are redirected to Keycloak for authentication, and Superset receives the necessary tokens to create a user session—no double login required if the user already has a Keycloak session.
For Keycloak, you can use either the Authlib-based OAuth2 integration or, if you run into compatibility issues, the Flask-OIDC integration. Both approaches require configuri…