Thanks
I was under the impression this webpage will allow testing of 'application' login.

The test is now directly on the SAP S/4 HANA SITE.
In the meantime I did the following where I can 'retreive' the Cookies and use HTTP.FormPost(TargetURL, FormData, Response) to log in. I then get a "CSRF token is missing" error.
InitSSLInterface; // Initialize SSL if using HTTPS
HTTP := TFPHTTPClient.Create(nil);
try
// Enable redirects to maintain session
HTTP.AllowRedirect := True;
HTTP.KeepConnection := True;
FormData := TStringList.Create;
FormData.Values['sap-alias'] := Username;
FormData.Values['sap-password'] := Password;
// Add any other required fields (e.g., anti-CSRF token if present)
try
Response := TStringStream.Create('');
try
HTTP.Get('https://my430346-api.s4hana.cloud.sap'); // Get the Cookies
ShowMessage( HTTP.ResponseHeaders.Text);
cCookies.Text := HTTP.Cookies.Text; // I protect the Cookies as the 'vanish' after POST
// Send the POST request
HTTP.FormPost(TargetURL, FormData, Response);
// You can read the response content from the Response stream if needed
ShowMessage( 'Response ' + Response.DataString);
finally
Response.Free;
end;
finally
FormData.Free;
end;
finally
HTTP.Free;
end;
cCookies.Free;
The following is the response I receive
***** Header *****
content-type: text/html; charset=utf-8
content-length: 8565
sap-authenticated: false
content-security-policy: default-src 'self'
sap-err-id: ICFLOGONREQUIRED
expires: 0
pragma: no-cache, no-store, private
cache-control: no-cache, no-store, private
origin-agent-cluster: ?0
sap-server: true
sap-perf-fesrec: 43239.000000
set-cookie: sap-login-XSRF_BVR=20260206095842-QHSUFNOq8JAd_lOsi2XbNQ%3d%3d; path=/; secure; HttpOnly; SameSite=None
set-cookie: sap-usercontext=sap-client=100; path=/; SameSite=None; secure
x-content-type-options: nosniff
strict-transport-security: max-age=31536000; includeSubDomains
x-xss-protection: 1; mode=block
sap-passport-component: none
***** Cookies *****
sap-login-XSRF_BVR=20260206095842-QHSUFNOq8JAd_lOsi2XbNQ%3d%3d
path=/
secure
HttpOnly
SameSite=None
sap-usercontext=sap-client=100
path=/
SameSite=None
secure
****** Result ******
{"error":{"code":"/IWBEP/CM_V4H_RUN/043","message":"CSRF token is missing","@SAP__common.ExceptionCategory":"CSRF_Token_Missing"}}
I am basically at the point where I think EITHER the cookie name is WRONG based on the error
OR
The HTTP.FormPost(TargetURL, FormData, Response) is not sending the cookie.
I also tried to include the Cookie in the HEADER but still no luck.
In the meantime I signed up to SAP in order to see if the Cookie 'name' is incorrect and ALSO ran an online test app to see what the name on the webserver actually is.
Use this url '
https://my430346-api.s4hana.cloud.sap' // Get the Cookies directly via Brave .
At this point I want to test a site where the Cookie will 'work'
Thanks
Adie