I have just developed a PERN stack SPA where the app and the server are both hosted on Heroku. The SPA uses Azure authentication (MSAL). Everything works well and user on authentication is redirected to our SPA hosted on Heroku.
Now the API which is built is still not secure. Anyone having the endpoints can access and manipulate data in our database. Can anyone guide with the current structure how can I authorize my server API's hosted on heroku with Azure AD credentials.
Example : https://my-first-app.herokuapp.com/getusers
The example API above can by used by anyone to get results, how can I prevent this and only allow users logged in to my SPA to use the API's only.