✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Can you add Azure AD login with flask oauth or flask oidc?

I know it’s a selling point for Dash Enterprise but in an open source project I’m trying to implement authentication on a Dash app. I need to find a Dash code example that I can try out and just learn from it.

It should be possible by using server = Flask(… and app = Dash(server=server, but I encounter problems that are very hard for me to troubleshoot, “not authorized” or “too many redirects”… I tried flask-oidc but no luck. I wouldn’t even know how to ask for help on the error so I just stick with it but now I’m almost out of ideas and even time on the project.

Is there a fundamental thing I’m missing? Is a Dash app fundamentally incompatible with the authorization code flow?

No, Dash is perfectly compatible. It’s just a little tedious to setup. I implemented a small lib for Keycloak (which supports most authentication mechanisms, I used LDAP), maybe it could inspire

I actually tried your package out when I first started, I learned a lot from it! I might use it later when I have enough requirements for a broker server to justify hosting it. Thanks!

Do you have any advice on the way to secure different callback-loaded pages in a multi-page Dash? I think we use flask routes in most Flask oauth/oidc packages to require login. Should I keep it like that or develop a “require login” attribute that works with the callback functions?