Symptom
You receive the below error when you try to make an Odata API call
Error : Basic authentication for ODATA API is disabled for company
Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental."
Environment
Odata API call with basic authentication
Reproducing the Issue
Trigger an API call on the browser (for example)
https://api4preview.sapsf.com/odata/v2/User?top=10
It would throw the below error
Basic authentication for ODATA API is disabled for company ABCDE (where ABCDE is the company id)
Cause
There are two possible causes for this error:
- In "OData API Basic Authentication Configuration" you have set the option "Never"
- In "OData API Basic Authentication Configuration" you have set the option "Restrict access to below IPs" and forgot to add the IP where the login attempt comes from
This is expected as per the configuration made in "OData API Basic Authentication Configuration"
Resolution
- Cause 1: You you flag the option Never, this means that regardless of who tried to perform a basic authentication your system will always reject it so you have two possible ways to fix it
- Check the flag "Always": this will allow all the basic authentication attempts to proceed as long as valis username and password is correct
- Check the flag "Restrict access to below IPs": This will allow the basic authentication to coming from the IPS you define here. Do not forget to degine the IPS.
- Cause 2: If you retrict the IPs allowed, any IP different from your list or range will be rejected so you need to review the list and add the IPs as you need
Note: If you want to define an IP range you need to make use of the wildcard for example, 111.111.111.*, if you use 111.111.111.11-111.111.111.99 it will not work.
Keywords
Basic authentication for ODATA API is disabled , KBA , LOD-SF-INT , Integrations , LOD-SF-INT-API , API & Adhoc API Framework , Problem