“401 Unauthorized” error during form data save
When you try to save a new form item, you encounter a “401 Unauthorized” error
Option1: If you are using location-based policy in SharePoint Online, disable it.
Option 2: Even though Microsoft claims that location-based policy might not be the best solution when using any provider-hosted SharePoint Apps you can apply a workaround. You need to include the IP Addresses that Azure websites are using in you location-based policy white list:
- Download the text file with list of IP addresses used by Azure websites (this list is taken from the official Microsoft Azure Datacenter IP Ranges document).
- Navigate to Access Policy Settings in Microsoft 365.
- Press the “Edit” button to edit the IP addresses white list.
- Paste the content of the downloaded file into a textfield that will appear (each address should be placed in a separate line).
- Press the save button (on the very bottom of the page).
- Wait until the policy changes get applied on the tenant. It might take up to 20 minutes.