Authentication with Dash?

How would it be possible to have authentication on my Dash app? I know that Dash has a basic authentication system, but i need something on ‘higher’ level. I would like to make my dash app available only for users logged on my site, or have a login page on my app, so that you can see Dash only after being logged, with sessions, logout etc.
Would it be possible on Dash? How can i do that?

In theory Dash wraps Flask as a backend server, so Flask login extensions should work to some extent.

1 Like

refer to this it may be useful.

1 Like

we can use nginx as proxy server behind gunicorn that is running dash app. And after that we can tune ldap autorization on nginx. So we dont need to change app’s code at all, just configure nginx


Thanks, i’ll look into this!

Another option is to integrate with Keycloak,

One of the benefits with this solution is that you get the login page for free. Also, you get pretty advanced user management with the ability to do both LDAP integration, kerberos, as well as manual user creation. With the dash-keycloak package (available on pip), the code changes in Dash are pretty minimal,

from flask import Flask
from flask_keycloak import FlaskKeycloak

server = Flask(name)
FlaskKeycloak.from_kc_oidc_json(server, “http://localhost:5000/”, config_path=config_path) # this line enables authentication
app = dash.Dash(name, server=server)

where the config_path refers to the location of a JSON config file which can be exported from the Keycloak GUI.