Flask and Azure AD

I have followed the Azure AD integration tutorial and that seems to work - I can press the “test” button and get a success page with my login details.

Then I used the same connection with the downloadable React sample and got that to work by logging in, clicking on the “Microsoft” button, so I’m pretty confident that the integration as a whole is working.

Now I’m trying to use that integration to work with a Flask app, based on the tutorial here:

Auth0 Python SDK Quickstarts: Add login to your Python Flask app

I can use the Auth0 integration to login by logging in with a username and password and that seems to work. However, if I click the “login with Microsoft” button I get an error message from the Microsoft end saying “invalid_request: The provided value for the input parameter ‘redirect_uri’ is not valid. The expected value is a URI which matches a redirect URI registered for this client application.”

The page that carries the error has the following URL:


So it looks like the redirect_uri is actually https://login.uk.auth0.com/login/callback, but I can’t see this URI mentioned in any of the tutorials I’ve followed up to this point, which always refer to my tenant domain. I’ve tried adding this login.uk.auth0… URI to the Azure AD configuration but that doesn’t seem to work either. Any suggestions?



OK, I fixed this. The problem was to do with the both the application and enterprise connection configuration at the Auth0 end.

First of all, in the application configuration on the Connections tab, I had mistakenly ticked the “windowslive” option. This is what was actually providing the “login with Microsoft” button on my login box, and was muddying the waters with the Azure AD connector I had created. Once I unchecked this option, there was no “login with Microsoft” button at all.

Then I had to go to the configuration for my Azure AD Enterprise connection and under the “login experience” tab, I had to check the box to “Display connection as a button”. Now the “login as Microsoft” button was back in my login box and actually using the Azure AD connection I had setup. Clicking this button then worked as expected.

1 Like

Wooohoooo! Perfect thanks for sharing it with the rest of community!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.