I have a modern UI web part in SharePoint Online. This component needs to invoke a custom REST API that will be hosted in an Azure web app (not SharePoint REST API). I may also call this API directly from JavaScript in SharePoint online pages. This will be deployed for different customers having separate SP Online tenancies.
I need to ensure that the API is called from SharePoint Online sites only and want to verify the Site URL and logged in user. That is, it should not be possible for someone to call this API directly. I do not need any specific authorization, just authentication of the SharePoint Online user and a way to verify that Site URL parameter sent in REST API parameters matches with the site of the page from where API is invoked.
Please point me in the direction to get this implemented.