Efficiency of logging users with Azure AD, and extract data from Microsoft Graph
I am building for a specific company a login system by a Microsoft user. After connecting the user, I need to extract data about him to know what permissions I can give him, and for this I use Microsoft Graph.
I am currently making a login with a Microsoft account using the Azure AD, and then the window opens where they receive the authorization code, which the user must enter in another window so that I can extract the data from the Microsoft Graph - in terms of user experience, this is a very long login And complicated, so I ask if there is an easier way to carry out this process?
This is the code that contains the login and logout functions of users connecting with a Microsoft account:
This is the code that contains the extract user data with Microsoft Graph: