How can I embed Superset Apache charts in my application bypassing login

Viewed 7553

I have been running into an issue where I modified "PUBLIC_ROLE_LIKE_GAMMA = True" in both superset/config.py and added the datasource to PUBLIC as per the link suggested reference in google.

But I'm still getting the AUTH login page while accessing the iframe.

2 Answers

At my work we had the same problem, we wanted to embed iframes on a web app and we kept running into the same issue. We really wanted to bypass it, so we implemented a custom security manager for it. If you're not afraid of modifying superset's code, you could take it as an inspiration; here's the fork. The modifications and how to use them are explained in the fork's README file. If you take a look you will see that not many files are needed to be modified in order to implement this!

Basically we delegated the login responsability to the web app, by recieving a token from it and passing it to an api that knows the web app's login policy. In the fork there's a mock of how an api would do such thing. When recieving data of a web app's user that isn't registered in Superset, we simply create the user for them with the info and log them in.

Afterwards the iframe looked like this, since we had a simple case, where a default welcome chart was all that was needed to be displayed:

<iframe
  width="600"
  height="400"
  seamless
  frameBorder="0"
  src="http://<superset-endpoint>/login?token=a"
>
Related