october 13, 2023
Integrating Superset into an application
Corporate reporting in large companies is not limited to standard BI tools. It is often necessary to develop solutions that allow using several products together, which imposes additional requirements to UI design, such as using a single authorization form for the entire application.
Faced with this task, we implemented a system that uses Superset access token to enter the user interface without login, complying with all security requirements.
The solution consists of several elements, the working principle of which is described below.
1. Interaction between Backend application and SuperSet.
We implemented server to server authorization, on which Application Kay is prescribed, which is reconcilable on both sides. The picture shows the mechanism of interaction:
— A request from Backend side to SuperSet to create user «test1»;
— SuperSet checks the Application Kay on its side and creates the user. After successful execution of the command, SuperSet returns the login of the user «test1».
2. Loading the SuperSet interface into the Frontend part of the application.
The main problem at this stage is not getting the SuperSet login and password form. The interaction diagram is shown in the figure below:
— Frontend makes a request from Backend, which knows the Application Kay:
— Backend requests the token for the test1 login that SuperSet generates and returns in response;
— Backend forwards the generated token to the Frontend part;
further it is allowed to load SuperSet directly from Frontend, bypassing the authorization procedure. To do this, use the URL to the dashboard, specifying token in the parameters.
To verify the solution, we will execute HTTP requests using the curl command line utility.
Send a request to create the user «test123»:
Request token for user «test123»
Go to the URL for dashboard number 9 using the obtained token.