I have a front end SPA (single page application) and back end api.
Each event in the SPA (like button click) invokes the respective api endpoint, and displays the result in the SPA.
I want to implement Azure AD based authentication so that only my Azure Tenant users are able to use the SPA/api.
Is the following flow correct approach to implementing such a feature:
- User opens the SPA
- User clicks on login button which opens Microsoft login popup
- User enters Microsoft credentials in the popup, and if credentials are correct then user gets the JWT token
- For every subsequent api request, the JWT token is placed in the bearer header
- The endpoint validates the JWT token using Azure public key and rejects the request if token is missing or validation fails.
Is this flow correct and what is such a flow called?