This is a multi-purpose Quart web app sample. Write your app like this once, and the same implementation will support 4x2=8 scenarios.
Microsoft Entra ID | External ID | External ID with Custom Domain | Azure AD B2C | |
---|---|---|---|---|
Web App Sign-In & Sign-Out | ✓ | ✓ | ✓ | ✓ |
Web App Calls a web API | ✓ | ✓ | ✓ | ✓ |
- Have Python 3.8+ installed
- Clone from this repo or download its zip package, and then start using it or build on top of it.
cd project_name
- Run
pip install -r requirements.txt
to install dependencies - Run
quart run -h localhost
and then browse to http://localhost:5000 You may need to change to a different port to match your redirect_uri setup.
Microsoft Entra ID | Microsoft Entra External ID | Microsoft Entra External ID with Custom Domain | Azure AD B2C | |
---|---|---|---|---|
App Registration |
Following only the step 1, 2 and 3 of this Quickstart: Add sign-in with Microsoft to a Python web app |
Follow only the page 1 of this Tutorial: Prepare your customer tenant ... |
Coming soon. |
Following only the step 1 and 2 (including 2.1 and 2.2) of this Configure authentication in a sample Python web app by using Azure AD B2C |
Configuration |
Copy this Entra ID template
as |
Copy this External ID template
as |
Copy this External ID with Custom Domain template
as |
Copy this Azure AD B2C template
as |
Do not reverse the order of the configuration steps above.
If you put your app credentials into the template and then copy it into |
||||
Web App Sign In & Sign Out |
With the basic configuration above, you can now browse to the index page of this sample to try the sign-in/sign-out experience. |
|||
Web App Calls a web API |
Add the web API's endpoint into your ENDPOINT=https://graph.microsoft.com/v1.0/me
SCOPE=User.Read Now restart this sample and try its "Call API" experience. |
|||
Deploy to Azure App Service |
|
You can follow the instructions for Quart, from the underlying library.
You can refer to the
source code of this sample
to pick up other minor details, such as how to modify app.py
accordingly,
and how to add templates for the new view (and for the existing index()
view).