10-25-2018, 07:33 AM
(This post was last modified: 10-25-2018, 01:21 PM by staff@ergosoft.it.)
Hi, I have a problem with a call in https with method POST.
from the documentation...
...
POST /auth/signin
the url is
https://demoauth.fatturazioneelettronica.aruba.it
this the istruction
"...
POST /auth/signin?grant_type=password&username=Utente&password=Password HTTP/1.1
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
Content-Length: 56
Host: localhost:8080
..."
when try to executo the code i receive this error
"...Error HTTP/1.1 400 Bad request'
-----------------------------------------------------------
this my Code:
Delphi 10.2.2 Tokyo
-----------------------------------------------------------
var
lHTTP: TIdHTTP;
lParamList: TStringList;
HttpAutenticazione : string;
begin
HttpAutenticazione := 'https://demoauth.fatturazioneelettronica.aruba.it';
lParamList := TStringList.Create;
lParamList.Add('grant_type=password');
lParamList.Add('username=demo');
lParamList.Add('password=demo');
lHTTP := TIdHTTP.Create;
lHTTP.IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(lHTTP);
lHTTP.HandleRedirects := True;
lHttp.Request.ContentType := 'application/x-www-form-urlencoded;charset=UTF-8';
lHttp.Request.ContentLength := 56;
lHttp.Request.Host := 'localhost:8080';
try
Result := lHTTP.Post(HttpAutenticazione+'/auth/signin', lParamList);
finally
lHTTP.Free;
lParamList.Free;
end;
from the documentation...
...
POST /auth/signin
the url is
https://demoauth.fatturazioneelettronica.aruba.it
this the istruction
"...
POST /auth/signin?grant_type=password&username=Utente&password=Password HTTP/1.1
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
Content-Length: 56
Host: localhost:8080
..."
when try to executo the code i receive this error
"...Error HTTP/1.1 400 Bad request'
-----------------------------------------------------------
this my Code:
Delphi 10.2.2 Tokyo
-----------------------------------------------------------
var
lHTTP: TIdHTTP;
lParamList: TStringList;
HttpAutenticazione : string;
begin
HttpAutenticazione := 'https://demoauth.fatturazioneelettronica.aruba.it';
lParamList := TStringList.Create;
lParamList.Add('grant_type=password');
lParamList.Add('username=demo');
lParamList.Add('password=demo');
lHTTP := TIdHTTP.Create;
lHTTP.IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(lHTTP);
lHTTP.HandleRedirects := True;
lHttp.Request.ContentType := 'application/x-www-form-urlencoded;charset=UTF-8';
lHttp.Request.ContentLength := 56;
lHttp.Request.Host := 'localhost:8080';
try
Result := lHTTP.Post(HttpAutenticazione+'/auth/signin', lParamList);
finally
lHTTP.Free;
lParamList.Free;
end;