I am working on SharePoint Provider hosted app for SharePoint Online. The remote web application is deployed on Azure Web App service(azurewebsites.net) and configured authentication/authorization with Active Directory.
I have remote event receiver for item added event. When I add any item to list it get triggered but it get unauthorized error 401. Error details: The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Bearer realm="xyz.azurewebsites.net"'.
If I enable Anonymous access to complete azurewebsites then remote event receiver get call.
Does anyone have faced this issue? Based on the error, SharePoint is calling RER with Anonymous scheme but azurewebsite is enabled with Active Directory Authentication. I tried allowing anonymous access to only AppEventReceiver.svc but that didn't worked.
<configuration> <location path="~/Services/AppEventReceiver.svc"> <system.web> <authorization> <allow users="?"/> </authorization> </system.web> </location> <!-- other elements --> </configuration>