403 Access Denied when calling SAP API from Ignition

I am trying to call a SAP API from Ignition. The API works correctly in Postman and browser, but when I call it from Ignition I am getting 403 Access Denied (SAP ICM error page).

The same request works in Postman with Basic Auth, but Ignition returns 403.

Thanks.

I believe Postman automatically base64 encodes your credentials. Try deleting lines 4 through 6 in your Ignition code and replace with this:

import base64

credentials = "your_username:your_password"
encoded = base64.b64encode(credentials.encode("utf-8")).decode("utf-8")

headers = {
 "Authorization": "Basic " + encoded,
 "Accept": "application/json"
}

If that doesn’t work, make sure the Ignition gateway’s IP is allowed in SAP’s icm/HTTP/auth or ICM allow rules.