'Print Azure AD SSO signed-in user details within flask app

Having Azure AD Single-sign-on enabled in single-tenant (SSO) in a docker web-app with flask app, I am trying to fetch username of currently signed-in user within my python flask application hosted through a docker.

I have used app-registration to authenticate web-app-service in single-tenant using https://{url}/.auth/login/aad/callback, and the app-service hosts a standalone docker image in the {url}.

Within the app, I need to fetch signed-in user's username to print out and log.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source